Storing GameObject(s) Playerprefs?

Hi there! I just wanted to know if it’s possible to store gameobject in playerprefs? If I’m going into details: I currently have a script that tells you what weapon you’re welding (var weaponInUse : GameObject:wink: and i just want to know if it’s possible to store the current weapon (gameobject) in playerprefs. If not, give me some examples to store them, thank you. :slight_smile:

No, since that’s essentially (or maybe is actually) a pointer, and it’s nowhere near guaranteed to be the same in a subsequent run.

Instead you need to say “This bazooka is Gun 5” and so you save a 5 as your current weapon. If you build it nicely it’ll be simple to just use an array index as the gun ID.