I note that i get errors when trying to load an es3 saved prefab containing textures ( its a ui prefab) n order to load properly :
i cant have the texture in an atlas
i need to use crunch compression
and enable R/W.
Is this correct ?
prefab save/load & Textures
Re: prefab save/load & Textures
Hi there,
If your Texture are generated or modified at runtime, then what you've described is correct. You would also need to ensure that they are saved by value rather than by reference, because otherwise a reference to that Texture won't exist between sessions.
By default Textures (and any field which derives from UnityEngine.Object) are saved by reference unless you're saving them directly. I.e. this will save by reference:
But this will save by value:
All the best,
Joel
If your Texture are generated or modified at runtime, then what you've described is correct. You would also need to ensure that they are saved by value rather than by reference, because otherwise a reference to that Texture won't exist between sessions.
By default Textures (and any field which derives from UnityEngine.Object) are saved by reference unless you're saving them directly. I.e. this will save by reference:
Code: Select all
ES3.Save("key", prefab.GetComponent<MeshRenderer>().sharedMaterial);
Code: Select all
ES3.Save("key", prefab.GetComponent<MeshRenderer>().sharedMaterial.mainTexture);
Joel