-3

I have a problem. I am facing a problem when preparing the gold system in unity 3d. I am using PlayerPrefs and the system does not work.I am collecting gold, the value is increasing, but when I go out of the game and enter the game again, the gold value is 0 again. I want the gold value to remain the same at the next entrance when I am out of play. Can you help me please.

derHugo
  • 83,094
  • 9
  • 75
  • 115

2 Answers2

1

The value has to be saved somewhere on exit and then loaded from there when you start the game again. Dont know if you refer to a system that is available in the asset store. If so there should be a documentation you can read that explains to use it.

Otherwise check out https://unity3d.com/de/learn/tutorials/topics/scripting/persistence-saving-and-loading-data

to set up a save and load system yourself

TheSkimek
  • 334
  • 1
  • 7
0

you need call PlayerPrefs.Save(), when you set value

huffy
  • 19
  • 2