Is possible to save the material,textrure,normal map with reference and then load them?

Discussion and help for Easy Save 3
Post Reply
khanx078
Posts: 10
Joined: Fri Jan 29, 2021 11:06 am

Is possible to save the material,textrure,normal map with reference and then load them?

Post by khanx078 »

Is possible to save the material,textrure,normal map with reference and then load them. Without making the texture, normal map read/write enabled.
User avatar
Joel
Moodkie Staff
Posts: 4852
Joined: Wed Nov 07, 2012 10:32 pm

Re: Is possible to save the material,textrure,normal map with reference and then load them?

Post by Joel »

Hi there,

You can do this by setting the ReferenceMode to ByRef. I.e.

Code: Select all

ES3.Save("myKey", material, new ES3Settings( ES3.ReferenceMode.ByRef ));
var mat = ES3.Load<Material>("myKey", new ES3Settings( ES3.ReferenceMode.ByRef ));
This assumes the Material/Texture/Normal Map isn't instantiated or modified at runtime, as it obviously wouldn't be possible to load it by reference in this case.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
khanx078
Posts: 10
Joined: Fri Jan 29, 2021 11:06 am

Re: Is possible to save the material,textrure,normal map with reference and then load them?

Post by khanx078 »

ok if the for instance i change the color at run time what approach should i use to save the object( texture, normal map, material , shader
) with maximum performance since I cannot use save by value as that makes the saving processing really slow.
User avatar
Joel
Moodkie Staff
Posts: 4852
Joined: Wed Nov 07, 2012 10:32 pm

Re: Is possible to save the material,textrure,normal map with reference and then load them?

Post by Joel »

Hi there,

If it's only the colour you're saving, you should save just the colour, rather than the entire Material. Then when loading, assign this colour back to your Material.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
khanx078
Posts: 10
Joined: Fri Jan 29, 2021 11:06 am

Re: Is possible to save the material,textrure,normal map with reference and then load them?

Post by khanx078 »

actually i wanna save the color, the normal map, the main texture
if possible also the material.

Code: Select all

ES3.Save("wallColor" + i,
                                obj.GetComponent<MeshRenderer>().sharedMaterial.color);
Even saving just this color is slow
User avatar
Joel
Moodkie Staff
Posts: 4852
Joined: Wed Nov 07, 2012 10:32 pm

Re: Is possible to save the material,textrure,normal map with reference and then load them?

Post by Joel »

Hi there,

It's likely slow saving the colour because you've got a lot of previously saved data in your save file. Try going to Tools > Easy Save 3 > Clear Persistent Data Path and see if this resolves the issue.

I also recommend taking a look at the Improving Performance guide:
https://docs.moodkie.com/easy-save-3/es ... rformance/

However, saving Textures is going to always be inherently slow.

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