Search Unity

Issue setting a modified property on a Prefab instance back to the value in the Prefab

Discussion in 'Prefabs' started by chanon81, Nov 20, 2018.

  1. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    168
    Hello,

    I have been using Nested Prefabs, and it is great. However, one thing that really bugs me is that, suppose I have a Prefab that has been instanced into a Scene.

    In the scene, I change a property of the prefab, for example, maybe the Prefab has a Sprite Renderer and I change the Order in Layer from default 0 to 10.

    The Order in Layer becomes bold:
    upload_2018-11-20_19-58-55.png

    Then I decide to set it back to 0. The problem is that even though the property is now the same value as in the Prefab, it is still marked as changed.
    upload_2018-11-20_20-0-52.png

    So now, it shows up when clicking "Overrides". And so to keep everything nice and clean I have to either revert or apply this "no change"

    upload_2018-11-20_20-2-8.png
    ^ Nothing actually changed, but I have to waste time to apply or revert it.

    It is also 'visual pollution' and makes it harder to find the actual changes (or if there are any) that really need attention.

    This is something that really bugs me.

    Also, since I have some [ExecuteInEditMode] components that automatically set the Order in Layer, then this results in all my Sprite Renderers being marked as changed, even though the value isn't actually changed.

    I think fixing this would greatly improve usability and ability to see what actually has changed.
     
    Last edited: Nov 20, 2018
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    This is by design. We can't assume that an override should be removed just because it has the same value as in the Prefab Asset. An overridden value will keep that value, also if the value in the Prefab Asset changes. If you no longer want that behavior you need to explicitly tell Unity this by reverting.

    Note that you can revert an overridden property by right-clicking on it and choosing Revert from there. You don't have to open the Overrides dropdown.
     
  3. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    168
    Oh, I kind of see the reason then. Thank you for the explanation!
    I guess I'll just need to adjust my ExecuteInEditMode component.
     
    runevision likes this.