- Home /
problem with create game Android
Hi, now I've decided to build a play for Android, this is part of the games category ("Tap Tap .." the wave sells money per second / clicks), but I have a problem. I put it on the phone when I walk in it and make money (progress) in it then go out, if I go back I put it from the beginning with (Money: 0 and others). How can I play to go further while I'm out of it (even stopped) and save myself? Then (for example, in play per second I get 5 $ / s and when I go out for a period of time) min and I get $ 18,000 on the 60mins (3600sec), but I want this to be saved without the player having to press the (save) button then (load), a kind of automatica./ Please, Please help !!! !
Answer by RatMoleRat · Jul 03, 2018 at 04:12 PM
To have it save automatically, you need to do the loading when the application starts and saving when the application closes. For when it closes, try OnApplicationQuit(), and for when it starts, put something in Awake(). This would go in a script that you have attached to a Game Object. That object would need to be there when the game ends (so OnApplicationQuit will be called) and when it starts (so Awake will be called). In Awake, you should put the reload function, and in OnApplicationQuit, put the save function. For the save function itself, investigate serialization. If you are programming in C#, here's some documentation to get you started: Serialization (C#)
Your answer
Follow this Question
Related Questions
Save a game code? 1 Answer
Score no longer works after backing up my game 0 Answers
Persistent data, Save file doesn't come out as hoped 1 Answer
Save/ Load game script in main menu 1 Answer
Save and Load Game 2 Answers