Saving and Loading Data
Times when we wish to load data include retrieving high scores from previous plays of a game, or perhaps remembering data values between scenes. Another time to load data is when a level layout is stored in a data file (such as text characters, or a data format like XML or JSON), and when a scene begins, that data is loaded and used to dynamically create GameObjects for the scene. And of course, we must have saved the data previously in order to be able to load it at a later time.
Some of the saving/loading is ephemeral – just while a game is playing – and everything is reset the next time the game is run. Other times, data can be stored that is remembered between game plays, either as part of the build application’s private data, or to shared folders that can be changed from outside the application, as data on a web server, or via a web communication.
Sometimes, data to be saved are as simple as individual numbers or text strings...