- Home /
Question by
Doneyes · Nov 22, 2012 at 02:37 AM ·
javascripttexturemodelchange
How can I change an objects texture through javascript?
I want to change TextureX on a model to TextureZ. Is this even possible?
Comment
Answer by Stopsecret · Nov 22, 2012 at 02:57 AM
Example script :
// Specify our new texture var TextureZ : Texture2D; //Change the texture when this function is called function Example (){ //Access the gameObject's renderer, and change the material renderer.material.mainTexture = TextureZ }
Hope this helps. -SS
It helps very much! But what if I am calling it from another location? Like the texture is not in the GameObject. How can I call on it from another location?