Hello everyone,
I have multiple gameobject instantiated with one gameobject template.
Sometimes I don't use them and I'd like to unload the spine texture on the gameobject template.
So I do it this way, and it works fine:
MeshRenderer oMeshRenderer = m_oGameObjectTemplate.GetComponent<MeshRenderer>();
Resources.UnloadAsset( oMeshRenderer.material.mainTexture )
But when I want to reload it, it doesn't:
Texture oTexture = (Texture) Resources.Load( sSpineTexturePath, typeof( Texture ) );
MeshRenderer oMeshRenderer = m_oGameObjectTemplate.GetComponent<MeshRenderer>();
oMeshRenderer.material.mainTexture = oTexture;
My gameobjects are still not visible after doing that.
I know the correct way would be to reload a "SkeletonDataAsset", and call "Initialize" on the "SkeletonAnimation"
but it slows down the loop, and I cannot do it in another thread (thanks unity). So I would like to do it this way, with only loading / unloading the resource.