Page 1 of 1

How do i save materials?

Posted: Mon Nov 11, 2019 9:18 pm
by legendarykeith
Hello,
I'm trying to save materials with easy save but it's not working:

Material colour;
ES3.Save<Material>("colour", colour);

Am i doing this right?

Thanks,
Keith

Re: How do i save materials?

Posted: Tue Nov 12, 2019 8:07 am
by Joel
Hi Keith,

That is correct, but be aware that properties of the shader which are not part of the standard Unity shaders will need to be saved separately. You can see what properties of the shader are saved by opening up the file at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_Material.cs and looking at the list of properties being saved there.

Also is the Material generated at runtime? If you aren't procedurally generating the Material, you might only need to save a reference to it, rather than saving the entire Material itself. If you are modifying a few properties of the Material, it would also be more efficient to save a reference to the Material, and the values of it which get changes, and then save and load these.

All the best,
Joel