Question by
TrintarVIII · Oct 10, 2015 at 02:19 AM ·
textureprefabmaterial
Texture/Material changes but is not reflected in the game world
I'm trying to change a texture of each instantiated prefab and they're all coming out the same color. If I inspect each of the instances, each has a different material/shader assigned to it with the different color. I'm guessing I'm doing something wrong but I can't figure out where.
var clone = Instantiate(prefab) as GameObject;
var texture = textures[Random.Range(0, textures.Length - 1)];
clone.GetComponent<Renderer>().material.mainTexture = texture;
clones.Add (clone);
Comment
Your answer
Follow this Question
Related Questions
Every object I drag into the scene turns yellow 0 Answers
How can i apply a material to a prefab ? -1 Answers
Tree leaves underside not showing 0 Answers
Shader change works, but no texture - Android 0 Answers
quickest way to custom texture a low poly human model 0 Answers