- Home /
Changing a material colour in a prefab loses the material ???
I have a prefab that I instantiate in a script, I change the material of one of the objects:
material.color = Color.red;
When I quit the game back to the editor, the material is marked as missing. Why?
Hi Sloan$$anonymous$$elly,
If you make changes while the game is running, they will not be saved when you quit.
$$anonymous$$ake your changes while the game is stopped, then save them. Your materials shouldn't go missing.
I don't want them to be saved :)
I have my material set up the way I want, but I want to alter the colour of the material at run time. When I change the colour through a script, and then quit to the editor, the material is then gone from the prefab.
I don't understand why, because all I'm doing is changing the 'color' property, not assigning a new material.
I have a prefab with a mesh that has a material assigned to it. I drop the prefab in a scene. I have code that changes the colour of the material at run-time.
When I return to the editor the placed prefab has the material emboldened (something changed) after a run and the actual prefab in the project view has the material missing.
I am using Instantiate() rather than Resource.Load() on the prefab.