I’m using a Save File object like I’ve always done but it doesn’t actually save anything in some circumstances but does in others. Makes negative sense.
My game is an endless runner. At the end of a run (when you die) a screen is showed with stats and such. At this point in time the games current stats are saved as you can see below:
This works. I know it works because I can check my stats in the main menu and they check out.
Here is something that doesn’t work:
The scenario is:
Player looks in a menu to buy a ship with in-game currency.
Player press the button to buy a ship with in-game currency.
Player is prompted by the game to make sure the player wants to buy this ship.
Player presses Yes.
Game checks whether the player have enough in-game currency to buy the current ship.
- If the Player does not have enough, then show a message saying so.
If the Player does have enough, then subtract the ships price from the saved amount of in-game currency in the save file, disable the “Buy with Thunderbucks” button, change the ownership text to “Unlocked” and go into the save file to change the fact that the ship is now available for use.
All of the above happens except that none of it is saved to the Save File. If I go to the next ship in the hangar you can acquire and back to the one I just bought, the ship can now be bought again and the changes have not been saved whatsoever.