• 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
6
Question by Katsura · Jul 20, 2011 at 10:18 AM · playerprefs

PlayerPrefs saving

Hello, everyone! I use some PlayerPrefs in my unity app (platforms are: iOS, Android, Windows). Now I want to release update, so it's a question: when users update there apps - will PlayerPrefs be saved? The problem is that I store the game progress in this prefs and if users will lose it after update - it will be very bad. Is there reliable information about this question? 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
2

Answer by BerggreenDK · Jul 20, 2011 at 10:45 AM

I would, if in your situation, build 2 small test apps. Then try to save something in playerprefs from testapp1, and then see if I can read it from testapp2.

If I can read the playerprefs from another app, my guess would be that playerprefs is bound to the device/player and not the app.

Second test would be to try to update testapp1 and then read the first information again, to validate that an update does not hurt data belonging to a certain app.

I havent tried this, but this is how I would proceed without any docs telling me how Playerprefs are implemented on smartdevices.

Update

http://unity3d.com/support/documentation/ScriptReference/PlayerPrefs.html

On Mac OS X

PlayerPrefs are stored in ~/Library/Preferences folder, in a file named unity.[company name].[product name].plist, where company and product names are the names set up in Project Settings. The same .plist file is used for both Projects run in the Editor and standalone players.
On Windows standalone players, PlayerPrefs are stored in the registry under HKCU\Software[company name][product name] key, where company and product names are the names set up in Project Settings.
On Web players, PlayerPrefs are stored in binary files under ~/Library/Preferences/Unity/WebPlayerPrefs on Mac OS X and %APPDATA%\Unity\WebPlayerPrefs on Windows. There is one preference file per Web player URL and the file size is limited to 1 megabyte. If this limit would be exceeded, SetInt, SetFloat and SetString will not store the value and throw a PlayerPrefsException.
But this doesnt say ANYTHING regarding smartdevices. Hmmm... ! My guess from this sentence: "There is one preference file per Web player URL and the file size is limited to 1 megabyte." is that its bound to the app, but just as I can change the unity3D file of a website, so should the App be able to change/update without destroying the Prefs. Thats my bet.
Comment
Add comment · Show 4 · 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 Katsura · Jul 20, 2011 at 10:49 AM 0
Share

Thanks. Yes, I'll do tests anyway (it'll take much time if I want to simulate the real case), so now I'm just looking for other people who have expierence in this question.

avatar image BerggreenDK · Jul 20, 2011 at 10:51 AM 0
Share

but now you've gotten me curious!

avatar image BerggreenDK · Jul 24, 2011 at 02:07 PM 0
Share

had any time to find the result yet?

avatar image Katsura · Jul 24, 2011 at 02:16 PM 0
Share

Yep, I checked Android and Windows: all PlayerPrefs are saved after app upgrade. I have not any iOS device for tests right now, but I guess it works well too.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

PlayerPrefs isn't saving between Scenes 1 Answer

Is PlayerPrefs efficient for mobile devices? 2 Answers

What happens if PlayerPrefs.Save() fails? 1 Answer

Baffling Resources.Load by playerprefs string problem. 1 Answer

Unlockable Levels 3 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges