Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Do not rise prefab override flag

Discussion in 'Prefabs' started by Vifi, Jun 24, 2021.

  1. Vifi

    Vifi

    Joined:
    Aug 5, 2013
    Posts:
    28
    Hi,
    i am building tool that will find gameobjects with some defects or with some specify attrubiutes. I indicate it by disable "not selected" gameobjects renderer (so it dissapears and only "selected" are visible). Problem in this approach is enabling/disabling renderer rise prefab override flag on gameobjects. It is just and editor tool so i rlly don't want to do that.
    Do you know if i can somehow preven that from happening?
    Or maybe can i reject that one action editor caused from prefab overrides?
    Or do you know some better way to highlight gameobject without prefab overriding?

    Thanks in advance and have a wonderful day!
     
  2. Epsilon_Delta

    Epsilon_Delta

    Joined:
    Mar 14, 2018
    Posts:
    165
    Hi,
    if you change the serialized property, there will be an override. You can maybe later undo it with Undo class, or manually undo it with PrefabUtility class.
    Maybe the better way will be not to modify gameobjects at all.
    Take a look at the SceneVisibilityManager:
    https://docs.unity3d.com/ScriptReference/SceneVisibilityManager.html

    Or you can try to make something like the hierarchy filter does, but I do not know how to do that and if you figure it out I would be certainly interested in how it is done.
     
  3. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    419
    Hi,

    I actually concur with Vifi,

    We should be able to flag a property to not trigger an override.

    typical example, if you have a complex radio button that for example switch images based on the isOn state and you made the component to work during editing for wyswyg purposed, this should not count as an override on the image component that changed imaged, only the isOn property should be ( and even so you might want to ignore that as well). yet of course, this is on a per case bases, so we should ( it would be great shall I say) to have a way to maintain a black list of properties to ignore as prefab overrides.

    I think it exists hidden in the system somehow, since transforms are not triggering overrides...

    Bye,

    Jean
     
  4. howardmealor

    howardmealor

    Unity Technologies

    Joined:
    May 21, 2021
    Posts:
    17
    Hi.

    Transforms are considered default overrides and, as such, are not indicated as overrides.

    It is planned to make it possible for users to mark properties as driven so they will be ignored by the Prefab system and not flagged as overrides.
     
    Reahreic likes this.
  5. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    419
    Hi,

    Excellent :)

    Bye,

    Jean
     
  6. Reahreic

    Reahreic

    Joined:
    Mar 23, 2011
    Posts:
    282
    This would be great, as we attach serialized Guid's to key components, but the prefabs of said components should never have the Guid set. The result is a cluttered prefab override list as we can't filter the field out.

    Do you know when this may be coming or if it's something we could patch in on our end?
     
  7. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    419
    Hi :)

    Any news on this? This is getting more and more important, for example when you have an IK system or actually constraints like the unity's lookat constraint component that executes In edit mode, it constantly pollutes the override list and you don't know then what really matters as override.


    Bye,

    Jean
     
  8. AdiRidA

    AdiRidA

    Joined:
    Dec 12, 2019
    Posts:
    8
    Hi!

    Is there anything new on this?