I am using the ES3 prefab script on my parent prefab and am experiencing some strange behavior with child gameobjects. It seems like sometimes duplicate child gameobjects get loaded when I restart my game. For example, I have a single child gameobject `TriggerCollider` and sometimes 3 or 4 of these are added to my prefab (this bug is inconsistent as far as I can tell) when I restart my game. Also if I try to destroy a child gameobject (using Destroy) before closing the game/saving the prefab, when I load the game again, a "ghost" gameobject renders which doesn't have the sprite, but still exists. Is there some setup I am missing for these child gameobjects? I have attached a screenshot to demonstrate what I mean.
This is how I am saving/trying to delete the gameobject:
Code: Select all
void OnApplicationQuit()
{
GameObject EmoteObject = GameObject.FindGameObjectWithTag("Emote");
if (EmoteObject)
{
// this does get called, I checked
Destroy(EmoteObject);
}
ES3.Save("bug", gameObject);
}