x


PlayerPrefs.Save() not saving before crashes

My gosh, I just found that PlayerPrefs.Save() isn't saving my state immediately (on iOS) so that if I call Save() and the game subsequently crashes, the state hasn't been stored on disk (flash). This is scary. The documentation says it writes to disk immediately, but I'm not seeing this behavior. In my case, for example, the user has purchased a theme, and if the game crashes and is relaunched, the game thinks the user hasn't bought it yet! Yikes. I was relying on PlayerPref to RELIABLY save all sorts of player state. I would hate to have to write my own storage manager. I'm using Unity 3.4.2. I don't want to upgrade to 3.5 as I know it will be painful and want to ship version 1.0 of my game first. Has anyone seen this scenario? Thanks in advance.

more ▼

asked Apr 07 '12 at 03:23 AM

jackpile gravatar image

jackpile
61 9 12 13

For what it's worth, I don't know that I've ever observed that behavior. You might see if you can put together a very simple test project that reproduces the issue; it may confirm that you're right (in which case you should submit a bug report), or might help you to troubleshoot your current woes.

Apr 08 '12 at 01:44 AM rutter

@rutter Thanks, it should be easy to create a new project that simply saves state and then crashes to confirm. Cheers.

Apr 10 '12 at 09:09 PM jackpile
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x301

asked: Apr 07 '12 at 03:23 AM

Seen: 377 times

Last Updated: Apr 10 '12 at 09:09 PM