Question by
gronie2014 · Apr 20, 2020 at 11:33 AM ·
c#savingequipment
Is using PlayerPrefs efficient for inventory?
Hello, I am wondering if using PlayerPrefs for inventory is good or not, because I have an equipment menu in my game, and for example I got two weapons in it, one with id "1", and the second one with id "2", and when i choose the one with id "1", then it instantiates that object in some level using PlayerPrefs. So the code looks like this in my onclick method: PlayerPrefs.SetInt("id", 1);
and in the GameManager the code looks like this: Instantiate(someWeapon[PlayerPrefs.GetInt("id")], blah blah);
Is it good or is there a more efficient way to do this? The equipment menu and levels are in separated scenes, so I don't know other way to pass the numbers through the scenes without PlayerPrefs. Any help would be appreciated :)
Comment