I have made a car in 3ds Max with about 11 different materials.
I want to change most of the materials in code. But I can only get to changte “Element 0”.
I’d like to be able to change (for example) “Element 4” as wel.
How can I make this work???
With this code I’m able to change “Element 0” by clicking 3 different buttons. Every button changes the material of “Element 0” to another material.
var Car : GameObject;
var CarPaint1 : Material;
var CarPaint2 : Material;
var CarPaint3 : Material;
function OnGUI()
{
if(GUI.Button(Rect(0,0,100,50),"Blauw"))
{
Car.renderer.material = CarPaint1;
}
if(GUI.Button(Rect(0,50,100,50),"Oranje"))
{
Car.renderer.material = CarPaint2;
}
if(GUI.Button(Rect(0,100,100,50),"Zwart"))
{
Car.renderer.material = CarPaint3;
}
}