Unity 3D – C# script – save and load file.

By | 19/12/2016

This is a simple C# script example for a C# class Player.
The class Player come with this content into Player.cs C# script:

To make this C# script for saving the Player into one file I used this C# script named SaveLoadManager.cs:

The script come with two parts for save and load files.
I used Serializable property to save a binary file named player.sav.
This script used also the Application.persistentDataPath to take the path of the application.
I used a Debug log output but if you want to use into the real application then is no need to use.
You can deal with any player settings and make new like player.magic or player.status.
Take a look at the comments in the script and that script highlights design issues.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.