Save only Transform and Material from Prefab

Discussion and help for Easy Save 3
Post Reply
noob_vulcan
Posts: 4
Joined: Mon Apr 25, 2022 4:38 pm

Save only Transform and Material from Prefab

Post by noob_vulcan »

Hi,

I am currently saving prefabs via ES3 Prefab script on them. It saves everything which I don't want thus increasing the file size.

Is there a way to select what I want to save like Transform and Renderer Info?
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save only Transform and Material from Prefab

Post by Joel »

Hi there,

The easiest way to do this is to go to Tools > Easy Save 3 > Auto Save > Prefabs, select the Components you want saved on the prefab from there, and set the Save Event and Load Event to None at the top of the window.

When you call ES3.Save on the prefab using code
it will acknowledge what you've selected in the Auto Save window, and because you've set the events to None, Auto Save will not be called.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
noob_vulcan
Posts: 4
Joined: Mon Apr 25, 2022 4:38 pm

Re: Save only Transform and Material from Prefab

Post by noob_vulcan »

Hi,

Thank you for the reply. Is there another way? because this way is not feasible for my project.

I am working on world building game where users can spawn different objects and create a scene and save it. So as of now I have around 150 different objects and selecting Components from the window is not feasible, because there is a lot of human error possibility.

Current Save Process -
1. All prefabs have ES3 Prefab component on them.
2. A Save manager class that has a list of prefabs that are instantiated
3. I'm saving this list in a file via
var newSaveFile = new ES3File("UserWorlds/" + loadedSceneInfo.fileName);
newSaveFile.Save<List<GameObject>>("prefabList", prefabInstances);
newSaveFile.Sync();
I only need to save Transform and Renderer Info(For Material) for all these objects. Is there a better way to do this?

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

Re: Save only Transform and Material from Prefab

Post by Joel »

Hi Vineet,

You can programmatically add an ES3AutoSave Component and assign the Components want to save to the ES3AutoSave Component's 'componentsToSave' field.

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