Chapter 7. Creating Save and Load Systems
Saving data within a game is very important, which can be seen in just about every game out there. There is all kinds of data that you might want to keep track of, not only for yourself, but also for the player. The player's inventory, enemies' position, the player's statistics, and a lot more can be saved and loaded from a file that you create. In Unity, there are several ways to save data that you can choose from. Earlier in this book, we already went over how to use PlayerPrefs
to save and load data. In this chapter, you will learn how to use XML and custom flat files, and then create a way to activate your saving and loading processes.
In this chapter, you will:
- Save data to a flat file
- Load data from a flat file
- Customize our flat file
- Save data to an XML file
- Load data from an XML file
- Implement a checkpoint-based system
- Implement an anywhere/anytime saving system