I have an issue where the changes I make to the child of an instantiated prefab are not being loaded back into the child object, but it is being instantiated twice, once with the default values, and then again with the changed values. To clarify, the parent gameobject is loaded fine, but the child is instantiated twice.
I have the prefab script attached to the prefab. I am saving a list of the instantiated gameobjects, and can see the child of these objects is stored in the json, including their updated values. The child gameobject is not a prefab and doesn't have the prefab script attached to it, it's just an empty gameobject (i.e just a transform). I am loading the objects back as a list using Load. It creates two instances of the child gameobject, the updated changed version, and the default version from the prefab.
How should this be working? It's like the reference is not matching up, so the loader doesn't know it should apply the saved values to it.
Code: Select all
ES3.Save("stockpiles", Find.instance.setStockpiles.Items.ConvertAll(x => x.gameObject));
List<GameObject> stockpiles = (List<GameObject>)ES3.Load("stockpiles");