I want to write a script that saves in interger value when the player hits a trigger in my scenes. I will then use this int value to load the scene when the player restarts the game and hits the “resume game” button (so each scene corresponds with a int value).
I don’t know where to start on this. I’m fairly certain that I can do the scene loading part, but how do I save an interger value to an outside file and then call on that file again when I restart my game or when a player hits a button?
I read that it has something to do with Serializing but none of the videos that I can find are helpful.
Hi.
I have made a simple tutorial on how to make a save system at this thread: Save and load object with his child
You can read the thread and find out how to make your own save system in minutes.
I will publish this tutorial to the public nowadays.
Hope this helps.
Thanks.
I think this tutorial explains it pretty well. You would probably just want to use playerprefs for your purpose:
PlayerPrefs are the simplest but least secure. Usually used for storing data such as audio settings etc.
JsonUtility is a good way of serializing objects, however, it doesn’t handle polymorphism very well.
Json.NET is the most complete solution that I have used. Serializes and deserializes very efficiently.
There are many others, but I have not used them myself.