material works in editor but not standalone

I’ve run into an issue that I can only imagine is related to assigning materials to a renderer. I’ve narrowed down the problem line in my script. I get no errors inside the editor and the code works there. However when run in standalone the code does not execute and unless I put that line in a catch try nothing past that line of code is executed.

I have an array (Material[ ]) that I populate via the inspector drag and drop. I’m simply assigning a renderer a material from that list.

It’s behaving as if the material is not being compiled into the executable, however it is available to the editor and works fine.

The section of code looks like this:

MaterialList mt = slides*.slide.GetComponent(“MaterialList”) as MaterialList;*
// the following line causes the problem
slides*.slide.renderer.material = mt.materialList[0];*
I’ve tried reimporting all my assets, but to no avail.

I figured this out. It seems I had another gameobject with the same name in the heirarchy. The editor finds game objects differently then how the standalone does. So there is no guarantee the same object will be found if another has the same name.