Search Unity

Nested Prefabs Improvements

Discussion in 'Prefabs' started by Sprawl, Jan 15, 2019.

  1. Sprawl

    Sprawl

    Joined:
    Jan 19, 2014
    Posts:
    42
    Nested prefabs are great. However, since they are so core to the workflow I think it was inevitable that they also bring a few issues with them.

    I've used the old prefab system for many years and after having used the nested prefabs for more than a month, here are the annoyances that our team encounter on a daily basis with the new system :

    • Most of our scenes are divided by rooms or environment using prefabs. For exemple, the Kitchen will be a prefab and the Living room another. If I want to move an object from the Kitchen to the Living Room, I cannot simply drag the object from one to another then apply the modifications on both prefabs.
    upload_2019-1-15_8-17-53.png
    • Modifying prefabs should now be done in prefab mode. However, sometime we actually need to see the environment around the prefab when modifying it. I would love to have an option to display the scene grayed out in the prefab mode.

      A workaround to this is to get a camera in the scene and use the game window to preview. Since we don't have cameras in the scene by default, this is time consuming and error prone to setup a temporary camera in the scene just to preview the changes.
    • When making multiple changes to a prefab not in prefab mode and trying to apply the overrides, it's now possible to apply multiple ones at the same time. This is made worse by the fact that the window is reset every time one is applied.

      upload_2019-1-15_8-28-35.png

    • When selecting a prefab in the Project window, it is impossible to see and edit its component. It was useful and fast to modify values directly that way without needing the extra step of opening the prefab in prefab mode. In addition, It was possible to compare two objects easily before. Now the quickest way to do it is to drag them in the scene so you can see the components on the instance of the prefab.

      If you really want to avoid being able to modify the prefab without opening the prefab mode, then I would suggest to at least show the components in readonly with the button to open in prefab mode.

    upload_2019-1-15_8-38-29.png upload_2019-1-15_8-39-33.png

    • When modifying a prefab that is nested within another one, the "override" button should be available directly on the modified prefab. It is confusing to have to go through the override button of the parent prefab to apply on the child prefab. It's nice to have the option but the override button should be there on the child too.

      upload_2019-1-15_8-45-51.png

    If there are workaround for those issues or if there is something I'm missing please let me know.
     
    Lars-Steenhoff and Kiupe like this.
  2. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    I agree with all of this. Nested prefabs are really powerful but the workflow is not really fast and not really intuitive. Would be great to address some issues like be able to see prefab components, be able to have the override button visible in the prefab instead of the root prefab, could be cool to have in the hierarchy an icon or whatever that indicate a prefab has override so you can know just by looking at the hierarchy.

    But, in the overall I'm really grad that improved prefabs are finally here :)
     
    NeatWolf, Lars-Steenhoff and Sprawl like this.
  3. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Right, we had to remove support for disconnected Prefabs since it was not conceptually compatible with nesting. And since removing a GameObject from a Prefab was a disconnecting operation, that is no longer possible.

    See the FAQ.

    We have this feature in progress.

    Our usability testing when developing the feature showed that this caused way too much confusion over what was being applied to what; this is why its not there. For that reason, we only allow "Apply All" to the outermost Prefab. If you mean applying specific components, then you can right click on a component header and apply it directly from there without opening the Overrides dropdown.
     
    Sprawl likes this.
  4. Sprawl

    Sprawl

    Joined:
    Jan 19, 2014
    Posts:
    42
    Hi, Thanks for responding so fast !
    I don't mean to be overly critical, I just want this feature to improve.

    This is troublesome since the alternative is really inefficient. It's a really weird flow to open the first prefab, create a new prefab with the object you want to move, delete it, open the second prefab and finally add the newly created prefab. This would also break any links to the object.

    Are there no way to perform a disconnecting operation in the background without having the user manually open the prefab ? I understand it's not safe, but for a smaller team I would take that over more steps.


    I must have missed it in the FAQ. From the answer I'm guessing this mean this is also in progress ?

    Good to know that we can apply individual components with right click. However, the window when right clicking isn't as useful as the "override" window. It's more error prone since it doesn't show what you actually changed. I think it should be the same window for consistency.

    If this causes too much confusion, would it be possible to have it as an option ? Everyone on my team was confused when the button wasn't there. Most of the changes we make are to the prefab and not the instances, so it's the "override" button that we would use most of the time.
     
    JesOb and Rich_A like this.
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,336
    You could unpack both prefabs, do the changes, and then overwrite the old prefab with the unpacked prefab by drag-and-dropping.


    I don't understand this. Wasn't disconnected prefabs just normal gameobject hierarchies with a pointer to the prefab it used to be connected to? What part of nesting makes that impossible to replicate?
     
    Sprawl and Rich_A like this.
  6. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Disconnected Prefabs have no robust sense of which GameObject is the root of the Prefab. Each object knew which corresponding Prefab object it is derived from, but that's it. In prior versions of Unity, if you moved some part of a Prefab out of it (thus disconnecting it), both the original Prefab (with some parts removed) and the part that was moved out appear as disconnected instances of the Prefab. We had to infer the root by checking how far up the hierarchy we could go before we hit a GameObject that had a different Prefab it pointed to IIRC.

    However, you can have a Prefab instance and then add an instance of the same Prefab as a child to that. Now we have a parent and child that are actually *different* Prefab instances (or used to be) but point to the same Prefab, so we can't simply crawl up the parents and see when they begin pointing at a different Prefab. It all becomes a mess because we're trying to infer information from data that doesn't have sufficient information.

    This is just one example of the problems it created. There were a lot and they were so complex, subtle, unintuitive and confusing that I can never remember the details off the top of my head.

    Apart from the fact we couldn't implement it in a robust way, the concept of disconnected Prefabs also very much leads to potentially destructive workflows. You lose all tracking of overrides when disconnecting, so you could never use it with Prefabs you have overrides on and want to keep those overrides. Unpacking Prefabs is equally destructive of course, but doesn't give any false sense that you've still retained your Prefab instance and can restore it to its prior status.
     
    Sprawl and Baste like this.
  7. Sprawl

    Sprawl

    Joined:
    Jan 19, 2014
    Posts:
    42
    Thanks for the answer, I think that would be the simplest solution right now.
    However I think it's a bit of a brute force method that goes against the workflow intended by the nested prefabs. You could easily apply things that you didn't intend to this way.

    @runevision

    I'd like to understand a bit better. Would it be possible to treat deletion of a gameobject inside a prefab the same way you are treating the deletion of components ? This would be the ideal workflow. By dragging a gameobject from one prefab to the other, you would get a removal on the first one and an addition on the other.

    upload_2019-1-16_8-36-13.png
     
  8. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    I'm not an expert on this aspect of the system, but I'll see what insight I can bring on this.

    For 2018.3 we didn't change what types of overrides are supported on Prefabs. It was always property modifications, Added and Removed components, and added GameObjects and still is. Supporting a whole new types of override would not be a small task, but I can't say how much work it would be. A major new project, similar to how supporting nesting was a major new project. Our focus was not to add new override types, but just to support nesting. There's a tons of additional things that would have been nice to address (see the FAQ), and a few of them we're looking into. But we can't do everything just because it would be nice if it worked that way.

    So would it be possible to treat deleted GameObjects as a type of override. Theoretically, sure. But it doesn't mean it's feasible under the constraints we're under.
     
    Sprawl likes this.
  9. Sprawl

    Sprawl

    Joined:
    Jan 19, 2014
    Posts:
    42
    Thank you for the clarification. I understand the goal was to support nesting, but it also made some manipulations impossible (or a lot more tedious) to do now. I think those should be the focus from now on.

    In any case, I think nested prefabs are a great step forward.
     
  10. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    This one is really annoying.

    Also, in the override dropdown, there should be an Apply/Revert all children option. Currently you will have to click through them one-by-one. Maybe it should only appear on a non-modified parent, which is normally displayed anyway.
     
  11. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Like I said further up in the thread, we're working on a way to select multiple entries in the Overrides dropdown and apply those at once.
     
    Stardog and Sprawl like this.
  12. Sprawl

    Sprawl

    Joined:
    Jan 19, 2014
    Posts:
    42
    About this. Is there any chance that we will have the option to activate this ? It really seems like a call that should be made on a team by team basis whether to have this feature or not.

    Right now, it seems that the new workflow is restricting the users a lot to prevent them from making mistakes. It would be nice to be able to turn some of those safety nets off when we don't need them.
     
    Stardog likes this.
  13. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    It's not just "switching a feature on". The whole dialog requires a completely different and more complex design, both in its interface and implementation to support applying to arbitrarily nested Prefabs. There are design issues we never fully found good solutions to back when we prototyped and usability tested this, and edge cases that were not well handled.

    Could we implement such a more complex and advanced version of the Overrides dropdown and make users optionally use that? Even though we know from data it results in much more mistakes and in more uncertainty when enabled? Yes we could, given enough resources, but we believe there are other things we could spend those resources on that would benefit far more people.

    And to be clear, we didn't remove the ability to apply to inner Prefabs. It's not a matter of "should this button be here or not" - that makes it sound like it was a yes or no binary choice. Rather, it's a matter of functionality that could be designed in a million different ways, each with different tradeoffs. And the design we chose - being able to apply to nested Prefabs via context menus - had lower risks of people making errors, while still addressing roughly the same use cases.
     
    Sprawl likes this.
  14. Sprawl

    Sprawl

    Joined:
    Jan 19, 2014
    Posts:
    42
    We disagree on the design choice. I have no doubt the situation is more complex that I imagine, but from a user standpoint, it's a bit scary when the answer to a "missing" feature that would help you is that it was a design choice. I hope you find a way to circumvent the shortcomings of the current implementation in the future.

    In any case, thank you @runevision for taking the time to answer all the questions. It really was useful. Also, despite the criticism, I still enjoy the nested prefabs a lot more than I did the old prefabs. I just think they could be better.