Home > Blockchain >  Is it possible to save variables set/changed in play mode?
Is it possible to save variables set/changed in play mode?

Time:01-18

I was trying to make a Stardew Valley-esque day manager where the in-game day, season, and or year is changed by interacting with a bed, but once play mode is exited, the variables are reverted back. I tried to set the variables within a StartCoroutine, and while in play mode, it worked and the variables were changed, but when I exited play mode, the variables reverted back.

CodePudding user response:

To persist data you probably need to save your variables somewhere else like a database. For this you can just use a txt file. Maybe just look up how to write and read data to a file. Do something like this: When you start the game read the data Right before closing the game write (update) the data

  • Related