I have a simple game where player search for items and pick them up. How would I set up a playerpref script, so that when the game is relaunched the player would not have to find them again? I understand playerpref’s a bit but I confused as to how I would save that an object was found and to not load it on re-launch. I’m not asking for a script to be written , just pointed in the right direction. Thanks in advance
There are many ways you could do this!
One I can think of:
var playerObjects : int[];
enum ObjectsYouCanPickUp
{
CoolObject,
UselessObject,
LuckyCoin
}
You then fill the playerObjects array as the player picks up stuff, not forgetting parseInt : playerObjects[freeIndex] = parseInt(ObjectsYouCanPickUp.LuckyCoin);
That way, you can save playerObjects in PlayerPrefsX(ArrayPrefs) as an int.