- Home /
Shader problem. Difference between Run/Build
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. Can anyone tell me why this may happen? Thanks!
//$$anonymous$$aterial vars
var materials : $$anonymous$$aterial[];
private var selected$$anonymous$$aterial : int = -1;
function OnGUI() {
GUILayout.BeginVertical();
GUILayout.Label("$$anonymous$$aterial:");
var newSelected$$anonymous$$aterial = GUILayout.SelectionGrid(selected$$anonymous$$aterial, materialTextures, 2, GUILayout.Width(75), GUILayout.Height(75));
GUILayout.EndVertical();
if(newSelected$$anonymous$$aterial != selected$$anonymous$$aterial) {
selected$$anonymous$$aterial = newSelected$$anonymous$$aterial;
//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[selected$$anonymous$$aterial];
}
}
}
Okay. 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.
Answer by CrazyDude · Feb 11, 2013 at 09:01 PM
Oh, I found the answer. It was cause because of "Optimize Mesh Data" option. Thanks!
Thanks. I was having a different shader normal issue and "Optimize $$anonymous$$esh Data" was the culprit
Your answer
![](https://koobas.hobune.stream/wayback/20220613092354im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Material/Shader issue 0 Answers
Material doesn't have a color property '_Color' 4 Answers
Materials dont work/change in Build. 0 Answers
Distribute terrain in zones 3 Answers