This error happens when I instantiate an object and parent it to another object in the scene. I save the file and then load and that errors shows up. When loading, the object also spawns with the saved position/rotation values except it's world position instead of local (because no parent).
Checking the types supported
https://docs.moodkie.com/easy-save-3/es ... rted-types and the transform should be saving the parent.
I've been able to reproduce this on an empty project -
In play mode, drag a Prefab onto an empty transform, we'll call it Parent Object, or instantiate it and parent it to Parent Object in that scene.
Save the instantiated or dragged prefab into a list, just like I'm doing below
Then Change Scene and then go back to that same scene
Load the list and the prefab gets properly instantiated but immediately gets unparented and it throws out the error.
///
However,I'm now having another error because I tried adding another list to the Prefab Manager script:
InvalidOperationException: Trying to load data of type System.Collections.Generic.List`1[UnityEngine.GameObject], but data contained in file is type of System.String.
ES3Reader.ReadTypeFromHeader[T] () (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:314)
ES3Reader.Read[T] (System.String key, T defaultValue) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:215)
ES3.Load[T] (System.String key, T defaultValue, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:510)
ES3.Load[T] (System.String key, System.String filePath, T defaultValue) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:482)
SaveAndLoadPrefabsInstantiatedAtRuntime.PrefabManager.LoadPrefabInstances () (at Assets/Easy Save 3/Examples/Save and Load Prefabs Instantiated at Runtime using Code/PrefabManager.cs:136)
I copied all the lines from the prefabInstances list and replaced with the new inventoryInstances list, so the script is the same except for the new lines for ES3.Save and Load.
Code: Select all
else
{
prefabInstances = ES3.Load(PrefabsKey, "SAVES/autofilepath", new List<GameObject>());
inventoryInstances = ES3.Load(InventoryKey, "SAVES/autofilepath", new List<GameObject>());
}
EDIT: I found this topic
https://moodkie.com/forum/viewtopic.php?t=2740 and the last post made me try hardcoding the Key value, because I'm building a string to have different keys and it worked... The error stopped showing as soon as I tried writing a string straight into the field.
But I can't use this as a solution because I need to have different keys depending on which scene the Player is in, so I'll always have to build a string to make a key...