I know this question has been asked before but I can't seem to get this to work for me. I have a prefab that I instantiate at runtime and have a script that has initially undefined values (shortened examples for clarity):
Code: Select all
public Bug : MonoBehaviour
{
public System.DateTime spawnStartTime;
}
Code: Select all
public void SpawnNewEgg()
{
InstantiatedBug = Instantiate(BugPrefab);
InstantiatedBug.GetComponent<Bug>().spawnStartTime = System.DateTime.UtcNow;
}
Code: Select all
void OnApplicationQuit()
{
ES3.Save("bug", gameObject);
}
Code: Select all
InstantiatedBug = ES3.Load<GameObject>("bug");
I saw that it might be possible to use `ES3ReferenceMgr.Current.Add(object, id)` to save the exact instance of the prefab but I haven't gotten it to work for me. Can I get some guidance as to how to make that work?