I’ve been working on this game recently and I tried changing the material colors for a prefab, but everytime I change to a different scene, the materials are reset back to the original color. I have been saving the materials but they still reset. And just to be clear, I am using the same material, I am just changing the color.
The materials also reset after closing and reopening unity. This also started effecting every prefab.
Are these changes happening via code? Or via the inspector during play mode?
I would check the docs on the Renderer component: Unity - Scripting API: Renderer.material
It states:
Note the bolded word. What you get is an instance (a copy), of the material. The same happens when assigning to it. This is defensive to prevent permanently altering assets, as otherwise your changes in play mode will permanently effect your assets (an often undesired behaviour).
If you want these changes to persist the changes must been saved in some fashion and recreated upon returning to the scene. Basically just normal save-game stuff.
It happens through the inspector. I’m not using any code
I figured out how to fix it, I was previously trying to copy and paste the material colors from another material but when I chose the color manually it worked. I also had to resave the prefab.