Question regarding internal save structure

Discussion and help for Easy Save 3
Post Reply
CitrioN
Posts: 6
Joined: Wed Mar 02, 2022 3:33 pm

Question regarding internal save structure

Post by CitrioN »

Hello,

I would like to know if the asset does need to know all component information internally before building the game or if it can handle runtime provided information?
I ask this because my game has runtime assembly injection via a modding system and I would like to also offer save support for that code.
The 2 possibilities to allow the saving of data according to the documentation are by using the ES3Serialiable attribute or custom types.
The custom types are obviously not possible in my case. I may be able to provide modders access to the attribute by creating a duplicate of it with only its defintion in the modding API but that would require the internal structure of EasySave to be able to act on external code using that attribute?

Thanks,
CitrioN
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Question regarding internal save structure

Post by Joel »

Hi there,

If you’re not using ES3Types, Easy Save simply looks for the field with the given name in the class and loads into this. In this sense it works with dynamically-loaded objects.

However, the field would need to adhere to the criteria specified in the Supported Types guide:

https://docs.moodkie.com/easy-save-3/es ... ted-types/

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
CitrioN
Posts: 6
Joined: Wed Mar 02, 2022 3:33 pm

Re: Question regarding internal save structure

Post by CitrioN »

Hello Joel,

thanks for the quick reply. Follow up question after I did some testing.
Unless I create an ES3Type for a monobehaviour I don't see it being saved.
Is there an option to enable all monobehaviours to be saved for a gameobject or do I need to manually query all monobehaviours I want to save from an object and save them manually?

Thanks,
CitrioN
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Question regarding internal save structure

Post by Joel »

Hi there,

If you're saving an entire GameObject then only MonoBehaviours with an ES3Type are stored (see https://docs.moodkie.com/easy-save-3/es ... s-prefabs/).

If you also wanted MonoBehaviours with the ES3Serializable attribute to be stored, you would need to uncomment the commented part of the following line of the Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs file:

Code: Select all

if(ES3TypeMgr.GetES3Type(componentType) != null /*|| ES3Reflection.AttributeIsDefined(componentType, ES3Reflection.serializableAttributeType)*/)
You can remove the line entirely to serialize all Components, but not all Components are serializable at runtime so this is strongly recommended against and we would not be able to support this.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply