- Home /
How to Load and Save individual gameobjects with unitySerializer.
I have a single game object that stores all of my variables that need to be saved. I want to save just that game object and this is my code for it:
using UnityEngine;
using System.Collections;
public class GameWideScript : MonoBehaviour {
public int ReachedLevel = 1;
public float[] levelTimes;
public int thislevel;
public float thisleveltime;
public void Start(){
DontDestroyOnLoad (this.gameObject);
//what do i put in the parentheses?
LevelSerializer.LoadObjectTree ();
levelTimes = new float[20];
}
//public int SetVariable
IEnumerator Wait(float wait) {
yield return new WaitForSeconds(wait);
Application.LoadLevel ("GameOverScreen");
}
public void GameOver(){
StartCoroutine (Wait(1f));
}
public float[] GetTimes(){
return levelTimes;
}
public void SetTimes(float[] times){
levelTimes = times;
}
public void Save(){
LevelSerializer.SaveObjectTree (this.gameObject);
}
}
The only problem I'm having is that I don't know what to put into the LevelSerializer.LoadObjectTree() parentheses. In the Getting Started Guide it puts a variable called yourData. But, I have no idea what the variable yourData is. So what am I supposed to put there to load this gameobject? Thank you!
Your answer
Follow this Question
Related Questions
Saving/Loading a GameObject with Texture on Unity3D with Unity Serializer 0 Answers
How to prevent loading from freezing the game ? 2 Answers
Error while serializing Material with Texture (UnitySerializer) 0 Answers
Sharing a project with team members not using PRO License 1 Answer
How can you use Unity to make an iOS app that's not a game? 0 Answers