- Home /
why material edit are persistent?
Hi,
Is it normal that when I change a material setting when the game is playing, it doesn't revert to the original setting when I stop? everything else does but the material settings it seems.
Is there a preference somewhere for this or am I missing a point? it's also very weird that material doesn't get reverted when I reimport a fbx, I guess the two problems have a common root isn't it?
Thanks for your help,
Jean
Answer by qJake · Sep 07, 2010 at 10:11 AM
Changing assets during runtime will change them permanently (basically, any "file" that you have in your Project folder, including skins, materials, scripts, etc). Any instance or game object that you change in the scene(s), however, do get reverted.
If you're doing this via code (you didn't specify), don't use gameObject.renderer.sharedMaterial
, instead, use gameObject.renderer.material
, this will prevent the material from being "saved".
Answer by runevision · Sep 07, 2010 at 11:31 AM
I might add to SpikeX's answer that even though Materials in the inspector of a GameObject are shown as though they are "on" that GameObject, this is really just a "shortcut". It still shows the referenced material (that most likely is located in the Project) and edits will be applied to that material.