Is there a way to set "save game object children" for a separate game object?

Discussion and help for Easy Save 3
Post Reply
fjl2007
Posts: 8
Joined: Sun Jan 07, 2024 2:47 am

Is there a way to set "save game object children" for a separate game object?

Post by fjl2007 »

Is there a way to set "save game object children" for a separate game object?
I know there is a global setting in the settings menu and there is an ES3 Game Object to decide which component to save.
But these two settings can not be set for a separate game object.
In my project characters have only a part that needs to save the children and have a big tree (i.e. bones ) that does not need to be saved.

The closet one is a global setting for excluding objects but it is wire to add all characters in it.

It would be best if there is a "save child flag" in the ES3 Game Object. When set it true the game object child is excluded from save.
Thanks in advance.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Is there a way to set "save game object children" for a separate game object?

Post by Joel »

Hi there,

You can do this by providing an ES3Settings object as a parameter to your ES3.Save call with the saveChildren flag set to true or false. I.e.

Code: Select all

var settings = new ES3Settings();
settings.saveChildren = false;
ES3.Save("key", value, settings);
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
fjl2007
Posts: 8
Joined: Sun Jan 07, 2024 2:47 am

Re: Is there a way to set "save game object children" for a separate game object?

Post by fjl2007 »

Great, thank you.

Can I overwrite the default settings and set them back?
like this:

ES3Settings t = ES3Settings.defaultSettings;
t.saveChildren = false;
ES3.Save(go.name, go, _sceneName, t);
t.saveChildren = true;
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Is there a way to set "save game object children" for a separate game object?

Post by Joel »

Yes, this is a valid way of doing it. You could actually simplify your code to this:

ES3Settings.defaultSettings.saveChildren = false;
ES3.Save(go.name, go, _sceneName);
ES3Settings.defaultSettings.saveChildren = true;

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
fjl2007
Posts: 8
Joined: Sun Jan 07, 2024 2:47 am

Re: Is there a way to set "save game object children" for a separate game object?

Post by fjl2007 »

Nice! :D
Post Reply