- Home /
Having wrong texture on my model?
I wanna change material of object programmatically, i am using this code, and have assigned both variables in inspector view but when i run the program it show just pink texture on my object. here is my code and screen shot. please help and thanks in advance.
#pragma strict
var yourMaterial : Material;
var newMaterial : Material;
function Start () {
renderer.material = yourMaterial;
}
][1]
[2]: /storage/temp/30721-screen+shot+2014-08-11+at+12.42.38+pm.png
[3]: /storage/temp/30721-screen+shot+2014-08-11+at+12.42.38+pm.png
Answer by gjf · Aug 11, 2014 at 08:05 AM
the inspector shows that there are no materials assigned to yourMaterial
or newMaterial
- that's why it shows up pink.
Your answer
Follow this Question
Related Questions
Changing two different objects renderer colour 1 Answer
Load Material Texture from File 2 Answers
renderer.material.mainTexture not changing texture... 1 Answer
Making objects invisible 0 Answers
Why are Textures applied to multiple materials script. 0 Answers