Hello everyone! I’ve got some stupid problem right here. I have made some script that changes the car material using GUI. When I try to change it into the Editor everything looks fine, but when I’m build my project and try to change it there, I’ve got some very bad result, material appears very white. Also I tried to change the material shader to just Bumped Diffuse or Specular and it’s work. But when I try to use the Bumped Specular, it’s make the result you see. It was fine before, but now it’s not. Can anyone tell me why this may happen? Thanks!
Here is the script:
//Material vars
var materials : Material[];
private var selectedMaterial : int = -1;
function OnGUI() {
GUILayout.BeginVertical();
GUILayout.Label("Material:");
var newSelectedMaterial = GUILayout.SelectionGrid(selectedMaterial, materialTextures, 2, GUILayout.Width(75), GUILayout.Height(75));
GUILayout.EndVertical();
if(newSelectedMaterial != selectedMaterial) {
selectedMaterial = newSelectedMaterial;
//on new material selected
partsElement = xmlData.DocumentElement.ChildNodes[selectedBrandName].ChildNodes[selectedCar].ChildNodes[selectedPart].ChildNodes[selectedSubPart];
//Sub parts
subPartsCount = partsElement.ChildNodes.Count;
for(i = 0; i < subPartsCount; i++) {
tempObj = GameObject.Find(partsElement.ChildNodes[i].GetAttribute("name"));
tempObj.renderer.material = materials[selectedMaterial];
}
}
}