How to Save Game in Unity

In this video, you will learn how to save your game progress in Unity. This video will involve C# programming and using JSON Utility for storing game data. The saved data can be stored in a .json file and will be loaded or saved by pressing a button.


Click the video to watch.

JSON save

Many people who make games in Unity usually save values with PlayerPrefs. The problem is, that system is only for saving player preferences like game settings.

It is not designed for some very complex data like game states or scenes with hundreds of scripts with their own number and string values.

To save your game in Unity, you need to make sure to add a player data manager. Unlike game manager and score manager scripts, this script can only store data.

It does not make gameplay better, it just stores all the values that every game needs to save for later use. The values – player position, health and score are part of the player data script that does not have MonoBehavior, it is simply a serializable script. The save and load are the public voids. The buttons need to add them in order to save or load the game.

,

Leave a Reply

Your email address will not be published. Required fields are marked *