Works in player but NullReferenceException in build.

I’m trying to “highlight” all parts of a model with a certain name. It works perfectly in player but in standalone build I get a NullReferenceException. Object reference not set to an instance of object. Dont understand why it would work in player but not the build. Any ideas? Thanks!

GameObject[] partsList = GameObject.FindGameObjectsWithTag("Part");
foreach(GameObject part in partsList){
    if(part.name.Equals(guid)){
         part.transform.renderer.material.SetColor("_Color", Color.blue);
    }
}

I figured it out. I was using a try/catch block for MissingComponentException. I switched to a simple null test of the specific component and it worked. Still dont know why it was caught in player but not in build though.

Try to change the object name. Works for me.