- Home /
Best option to change texture/material..
Hi
Today i have been working to get change textures at runtime and i'm not sure which is the best option, in the final step, to update texture and material. I don't know if some of them is better for some reason, related with performance or something.
renderer.material = newMaterial;
renderer.sharedMaterial = newMaterial;
renderer.material.mainTexture = texturaAtlas;
renderer.materials [ 0 ].mainTexture = texturaAtlas;
renderer.material.SetTexture ( "_MainTex",texturaAtlas );
Is so curious that in the api documents reading about material, says to use "sharedMaterial" when u want to change it. I suppose that maybe says that because changing sharedMaterial really u are changing the material for all instance but i'm not sure. http://docs.unity3d.com/Documentation/ScriptReference/Renderer-material.html
Really i no need now change texture because i apply the new material with it, but i'm interested to know too. Thanks, ciao.
Your answer
Follow this Question
Related Questions
How to create a GUI button to change a character's texture in real-time? 2 Answers
Cost of changing texture 0 Answers
Changing GameObject texture? 4 Answers
How can i change detail texture? 1 Answer
Change Material of an Object. 5 Answers