I have a scene with prefabs "Container" and "Item" where I'm trying to add Item as a child of Container at runtime, both have the ES3 Prefab component and I'm using autosave. I've found if I create an instance of Container at run time and then attach an instance of Item then exit, when I load the scene the instance of Item is not attached to Container but is instead loaded at a different location (probably 0,0,0). Now if I have an instance of Container that was created by dragging the prefab into the scene from the editor (i.e. not created at run time) and then attach the instance of Item to it, when I load the the scene the Item instance is attached to the Container instance.
Is there a way to save the parent-child relationship when the parent is created at run time/is the issue that the parent is being created at run time?
Thanks for your help.
Autosave child game object added at runtime to prefab instance created at runtime
Re: Autosave child game object added at runtime to prefab instance created at runtime
Hi there,
In this case the issue is likely because the child is being loaded before the parent (objects are loaded in order of instantiating).
In this case you would need to load twice: once to load all references, and once to ensure that all can be assigned to fields. See the Triggering Auto Save section of the Auto Save guide for information on manually triggering Auto Save to load:
https://docs.moodkie.com/easy-save-3/es ... hout-code/
All the best,
Joel
In this case the issue is likely because the child is being loaded before the parent (objects are loaded in order of instantiating).
In this case you would need to load twice: once to load all references, and once to ensure that all can be assigned to fields. See the Triggering Auto Save section of the Auto Save guide for information on manually triggering Auto Save to load:
https://docs.moodkie.com/easy-save-3/es ... hout-code/
All the best,
Joel
Re: Autosave child game object added at runtime to prefab instance created at runtime
Looks like that worked, thank you!