- Home /
Protect a value from Apply
I need a way to protect some concrete public values of prefab's instances from Apply.
Example: I have a soldier (An instance from a Prefab) with many modified values exposed on the inspector such as:
Health
Waypoints Array
Speed
Each soldier comes from the same Prefab but each one has different values on these variables.
Let's suppose that I want to change the material, or the mesh, or add some component or some child object.
After doing the changes, when I click "Apply" all the values of my soldiers will be the same than the soldier from I "Applied" the changes.
I discovered that interesting possible solution in the forum:
http://answers.unity3d.com/questions/135886/apply-prefab-except-for-one-component.html
But it's not perfect, since It's mandatory to do little changes to all the values of the class even if you don't want to have a different value from the original, what it's really annoying.
Is there another way to protect a especific value from the powerful but dangerous "Apply"?
Years later and I still would really love an answer to this. I was hoping there could be a C# attribute you could just be like [IgnorePrefabApply] or something on the field(s) you want to ignore applying to the prefab!
Answer by SharkoFR · Apr 29, 2018 at 08:07 PM
hi! you can change variable like int, bool, float on just 1 soldier but the material or the mesh is the same for all which means if you change only 1 material on 1 soldier, it apply it on all. if you think i don't understand your question, can you send screenshot and more explain please.