Page 1 of 1

ES3 Not saving basic components on GameObjects

Posted: Mon Jun 20, 2022 2:43 am
by Kyper
I have a gameobject that has several Monobehaviours with basic native fields.

According to the documentation, this should be able to save and load without any additional work. I am drawing this conclusion from the following statements in the documentation:

"Easy Save can automatically save the following types: [Components/MonoBehaviours]"
and
"A field in a supported class will be serialized if it: [Is public, or has a [SerializeField] attribute]"

However, when I save and load, it only has the transform and some other basic stuff. When I inspect the save file, I can confirm that it is indeed not including the basic monobehaviour scripts in the list of components.

Simplified sample that doesn't seem to be working for me:

Code: Select all

public class TestSaveV : MonoBehaviour
{

    [SerializeField]
    private string test;
}

Re: ES3 Not saving basic components on GameObjects

Posted: Mon Jun 20, 2022 3:19 am
by Kyper
For anyone reading this. I did find a similar question and an answer from the developer.

https://moodkie.com/forum/viewtopic.php ... ours#p9766


It would be REALLY nice to have an officially supported way to do this. It cuts back on an absurd amount of time.

Edit: Though it seems this potentially breaks deserializing some e3prefabs? I will post back here if I solve this or if I find out this is an incorrect statement.

Re: ES3 Not saving basic components on GameObjects

Posted: Mon Jun 20, 2022 9:25 am
by Joel
Hi there,

We intentionally don't serialise these Components because the Serializable attribute indicates that it's Editor-serializable in Unity, but not necessarily runtime serializable. Saving something which isn't serializable at runtime will cause unexpected behaviour and often a hard crash.

For more information on what will be saved on a GameObject please see the Saving and Loading GameObjects guide:

https://docs.moodkie.com/easy-save-3/es ... s-prefabs/
This will save and load the following:

layer, tag, name and hideFlags.
Components on the Natively-supported types list, or those which have been manually supported using an ES3Type.
All of the above for every child of the GameObject.
All the best,
Joel