Search Unity

Feedback Prevent Prefab instance overrides

Discussion in 'Prefabs' started by zander_m, Jun 4, 2019.

  1. zander_m

    zander_m

    Joined:
    Feb 7, 2019
    Posts:
    10
    Do you think we could get a way to mark a Prefab instance in a scene as "Not Allowed to have Overrides"?

    I'm working on a project with several unique prefabs placed into a scene that we never want to create additional instances of. These particular prefabs exist to help minimize merge conflicts and thus we always want changes to be made directly to the Prefab Assets. I'm frequently finding myself resolving complex merges where edits to these prefabs are "randomly" spread between the Prefab Asset and the Prefab Instance (overrides) because it's so easy to make changes from the Scene view and not apply them. These changes almost exclusively come from artists and designers who get confused by the technical complexities of the Prefab Instances + Overrides flow.

    In this situation, it would be fantastic to be able to mark a particular Prefab Instance in a scene as being "not allowed to have overrides" or some other form of "finalized".

    I think an ideal implementation of this would have the marked prefab not show it's children in the Hierarchy and only show it's prefab alignment in the Inspector when selected. Modification to anything other than the prefab alignment could only be done by opening and editing the Prefab Asset directly.
    This would prevent less technical contributors from unintentionally creating prefab overrides, help expose more users to the Prefab Editing workflow, and add additional clarity to how a particular prefab is expected to be used within a scene/project.

    (It'd be a bonus if double clicking this marked prefab instance in the hierarchy was a fourth option for opening the Prefab Asset in the Scene view for editing, maybe even automatically setting the current scene as the Editing Environment)
     
    Xarbrough and TurboNuke like this.
  2. jschroyen

    jschroyen

    Joined:
    Aug 19, 2015
    Posts:
    22
    We have the same set up, with core prefabs in a central scene that should not get overrides. We currently don't have any safeguards like you're talking about.
    There are a few inspector attributes you can use to hide everything in the inspector, have a look through the docs.
    There might also be some stuff on the asset store to Lock gameobjects
     
  3. zander_m

    zander_m

    Joined:
    Feb 7, 2019
    Posts:
    10
    Yeah, there are some hacky ways around it (similar to custom pre-2018 implementations of nested prefabs), they just aren't at all convenient. The HideInInspector attribute can sort of help, but afaik there's no way to apply it conditionally in order to leave the intended prefab editing workflow unchanged.

    I think you could maybe get close to the implementation I'm describing using a heavy coating of custom inspectors and managing HideInHierarchy flags yourself... but again, it's way more overhead and maintenance than any official implementation would be.