Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by auzette · Jan 23, 2012 at 06:20 PM · persistentdatapathdatapath

When to use persistentDataPath versus dataPath

Hello. I'm working on a game that will be both PC/Mac/iPhone. I need to store data for these locally for players (game state), and was looking at the best way to do this cross platform.

I see that there is both a dataPath and a persistentDataPath. dataPath is fairly well documented, persistentDataPath (which eludes to being the place to store data between runs) doesn't give quite as much context as to when it's appropriate to be used versus dataPath.

has anyone used the two and can they tell me which one they'd use to store the game state data? I did a search here and found three questions related to persistentDataPath, but none of the three were answered. Is peristentDataPath useful, or do people use dataPath and amend it as needed based on the underlying OS.

Thanks.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
6

Answer by OnlineCop · Apr 24, 2012 at 12:38 AM

Late reply, but Application.dataPath will give you a read-only directory where the entire project can be found. If you have a sibling folder to your Assets/ directory, you can use it like:

 Application.dataPath + ".." + Path.DirectorySeperatorChar + "sibling_path"

The Application.persistentDataPath is different for various platforms (iOS vs Android), and is the /Documents directory, a read-write path where you can put your downloaded stuff (new assets, for example).

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Tasmia · Mar 31, 2014 at 05:54 AM 0
Share

What if I am unable to get persistentDataPath :(

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can't transfer file from datapath to devices 1 Answer

Application.CaptureScreenshot() does not save any image on Android while it does on Editor! 0 Answers

SqliteException: Unable to open the database file - Ready-made DB Provided To Access 0 Answers

Streaming Assets or Persistent Data Path for reading files after build. 1 Answer

[Android - Data save issues] Does the 'install location' determine the location of persistentDataPath? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges