Shader problem. Difference between Run/Build (497172)

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];
    }
    }
    }

I’m not sure if it’s allowed to bump, but I’m really need to fix this in fastest time. I have no more ideas why it’s happening :frowning:

First make sure Edit graphics emulation is off in unity, also see if changing quality settings when launching the built project changes any thing, perhaps you had it on fastest and its not calculating the pixel light correct.

If that doesn’t work you’d need to wait for someone with more shader knowledge then me to chime in.

Oh, I found the answer. It was cause because of “Optimize Mesh Data” option. Thanks!