- Home /
Saving Hierarchy to file
Sorry Im still quite new and needed some help with this.
I saw a tutorial for saving in Unity requires knowing all the var in the scene. is it possible just to save the status of all Hierarchy gameobjects in one and call them back when player loads up save file?
Or do I have to manually set up unique var for each event I need to save?
All this saving has me a little afraid to go further with my game.
Answer by JinJin · May 08, 2015 at 12:16 PM
implementing a save game functionality is a big and important part of the game. unity does not have any classes to handle this - you must write your own.
if you are new at this, you should be careful - you must know which variables you want to serialize. it is a lot of work, but it is not hard :)
you can start with implementing the ISerializable interface:
http://tech.pro/tutorial/618/csharp-tutorial-serialize-objects-to-a-file
we use this approach in our game.
yeah im still quite lost. I see where that tutorial supposed to help but I dont know how to apply it to my needs.
I guess the only things I need saved are:
Player's Position in 3D space (including rotation)
what objects have been triggered on and off
for right now thats the basics of what I am needing saved. I have been looking on other tutorials but they all focus on stats and not player position.
Your answer
![](https://koobas.hobune.stream/wayback/20220613194758im_/https://answers.unity.com/themes/thub/images/avi.jpg)