- Home /
Saving/Loading variables
I'm making a game that uses an array to keep track of which levels have been completed, and which haven't. My question is, how do you save the array so that the next time the player plays my game (online), the array is called back into existence and the player doesn't have to do those levels again? Also, while I don't need it in Javascript, it'd be nice since that's what I use. Thanks!
Answer by Mike 3 · Jun 18, 2010 at 01:37 PM
Check this script on the wiki:
http://www.unifycommunity.com/wiki/index.php?title=ArrayPrefs
It'll let you persist your own int, string etc arrays very easily
PlayerPrefsx is obsolete, ArrayPrefs/PlayerPrefsX (different capitalization on the X) isn't
How would I go about implementing this? I'm trying "PlayerPrefsX.SetIntArray(arguments)" and Unity gives me errors about unknown identifiers. The code is also not picked up by the syntax highlighting.
make sure you put the script(s) from the page into one of the earlier compilation pass folders, e.g. Plugins