I was wondering if I could get some details on how the Prefab saving is supposed to work. I have of course read the documentation regarding it but it is pretty bare bones from what I can see.
And just as a forewarning, I am using the prefab loading because I have a material that cannot be serialized at runtime & it is not in the scene before runtime. I understand that this causes issues with ES3 since there is no reference to pull from but that is why I am looking to use prefabs to avoid having to have a reference to the material at all.
My assumption going into prefab saving was that I would essentially be saving(to json) a referance to a prefab and that prefab would be instantiated instead of the normal ES3.Load workflow of constructing a GameObject based on its serialized data from the save JSON. Its hard to tell given that there are (at least from what I can tell) no examples of using the Prefab saving described in the docs. Only examples of manually handling it which would be fine for my purposes if thats all there is, I just want to use an existing solution if its already been written.
Some more preface for my setup:
I am instantiating Gameobjects at runtime,
When I hit a save button I am collecting all the Instantiated GameObjects in a GameObject[] array
To save them:
Code: Select all
ES3.Save<GameObject[]>(key, array)
Code: Select all
GameObject[] loadedObjects = ES3.Load<GameObject[]>(key)
What does saving a prefab do differently from saving a GameObject?
I see that when I enable saving for prefabs it is actually just adding the ES3Prefab script to my object and running: "GeneratePrefabReferences()"
And I see that when I save the Object using ES3.Save it has a special value in JSON called "es3Prefab" outside of the "components" section.
Which all indicates to me that my initial assumptions that I mentioned above were correct, however when I continue to look at the save JSON I see that ES3 is still serializing the entire object. I was expecting it to stop serializing when it saw the prefab since it can just instantiate the prefab by reference when it loads. And when I go to ES3.Load the prefabbed object, it tries to reconstruct the entire the object based on the Serialized save data.
I assume I'm missing something big here, but I just don't get what saving a prefab is supposed to do given that it seems to just serialize the whole thing and load the entire serialization anyway.
I would really recommend adding example projects for everything described in the docs.
I would also really like to see more of the "nitty gritty" stuff explained on the docs to better inform users how to use the plugin. Like I said, its not even clear to me if I am understanding what the Prefabing Saving is supposed to do since the docs just briefly explain how to do it.
Thanks so much,
Connor