Search Unity

Nested Scenes instead of Nested Prefabs

Discussion in 'Prefabs' started by NathanWarden, Oct 8, 2018.

  1. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    While I think the nested prefabs are a great step forward from what Unity is currently offering they seem to still be one step behind, overly complicated, and not solve problems that still exist. A nested scene system, where the nested scenes have over-ridable fields makes a lot more sense.

    I've been using Godot on the side for a few years now and have been able to do everything the nested prefab system does, but without the clutter. I work at a medium sized company right now where it's quite difficult to work on large scenes without stepping on each other's toes.

    Solution (before nested prefabs 2018.2): Break the project into multiple scenes. (IE. Terrain, vegetation, props, gameplay, etc)
    New Problem: Now, how do we set up an environment and do lightmap baking without making our project overly complicated?

    Nested prefabs will be an okay solution to this, but only if each of these scene layers (which can be quite large) is now a prefab, which contains its nested prefabs.

    In other words, we'll be placing each of our entire scene layers into a prefab. So at that point, why not just have a nested scene system (like Godot Engine has) at this point? It is much simpler to comprehend and gets the exact same job done as nested prefabs, but without the project clutter (and mental clutter).

    ==== Conclusion ====

    So, in Godot I have to learn one thing... scenes. In Unity I have to learn scenes, prefabs, and each of their modes in order to get the same job done as what I get learning one concept in Godot.

    Sorry if this is a bucket of cold water onto nested prefabs, but they really feel like a step backward from what an Godot engine is offering. I know this won't change that nested prefabs are coming, and I am truly grateful that they'll be better than regular prefabs, but this might be some consideration for the future :)

    Thanks :)
     
    Ricks, Flavelius and MechEthan like this.
  2. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    IIRC they are working on something called Scene Fragments. Not sure when we can get this feature.
     
    NathanWarden likes this.
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    First I've heard of scene fragments. I'm using multi scene a fair bit now, and wondering what that would be.
     
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Yep, me too. Google search didn't yield any results :oops: Where comes this information from?
     
  5. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    No idea, though I imagine someone somewhere at a Unity workplace is wondering just who is working on Scene Fragments... maybe

    I think they are working on some magic button called Make Multiplayer. Not sure when we can get this feature either.
     
    Prodigga and phobos2077 like this.
  6. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    You can do that in Unity already. Simply write your own scene management solution.

    It's that simple. It's possible split & load scenes based on chunks that way.
    Actually, I've got a solution running in less than 2k lines of code, including custom editor.

    Multi-scene setup offers basically what you've described. It's all about the management.
     
  7. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    That would be really nice if they did something like that :)
     
    optimise likes this.
  8. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    rz_0lento, 5argon, Flavelius and 2 others like this.
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    So lets have 'em then Unity. Open world game here waiting.
     
  10. Jonathan-Westfall-8Bits

    Jonathan-Westfall-8Bits

    Joined:
    Sep 17, 2013
    Posts:
    271
    You must have a black belt in google-fu sir and I respect it. Saying that this would be a very welcomed feature and I can't wait to see where it goes.
     
  11. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    Thought Scene Fragments were going to be in 2018.3 when I saw the live stream, guess we gotta wait a little while longer.
     
  12. Schmunkee

    Schmunkee

    Unity Technologies

    Joined:
    Sep 4, 2013
    Posts:
    6
    @NathanWarden: You bring up some problems around Scenes that are of very high priority for us to tackle.

    It's correct that we were working on Scene Fragments and that the idea was to ship an early preview version in 2018.3.
    However, it turned out Scene Fragments was not the right solution, for a number of reasons that I won't get into here. Suffice to say it wasn't future proof.

    That said, we've by no means given up on solving these problem. If you want to help us, the best thing you can do at this point is to tell us about your use cases around Scenes. @hippocoder, I don't mean to put you on the spot here, but if you really do have an open world game brewing, we'd be interested in learning how you ideally want to structure your Scenes for that.
     
  13. recursive

    recursive

    Joined:
    Jul 12, 2012
    Posts:
    669
    So. I can describe what I need for my own projects as well as for my employer.

    At my employer, they've got a lot of ex-Unreal Artists/Modelers who have experience with Unreal's layered scene system and I have to agree, it's good for separating responsibilities and scripts, allowing the various disciplines to focus on their own problem domain most of the time. I remember when I worked for a AAA studio we had various layers like "Deco", "Base Geo", "Art Geo", "Terrain", "Audio", "NPC", "AI" etc...

    For my own projects, my Art Director and Level Designer would like a way to have a way to mark objects in scenes with some sort of conceptual tags and be able to isolate visibility to specific sets of objects to minimize misclicks on irrelevant content. These conceptual tags would be completely separate from the current gameobject tagging system, and would be orthogonal to any sort of scene layer system or the current additive scene system. It'd probably be more like the project asset tags than anything else, a meta-data only thing, and an object can have multiple tags.

    As the best example I have right now:
    Let's say I have a castle, with guard towers and a guard wall, a moat, and a keep, with some spires.

    An artist would tag the various parts with "guard tower", "guard wall", "moat", "keep", "spires", "keep-hall", "keep-garden", so on and so forth. This would work across additive scene loading or streaming chunks or what-have you. An artist could load up all of the additive scene layers, select "guard tower" and "guard wall" and isolate to only assets matching those, with all other aspects of the workflow being the same.

    Bonus points if such a tagged isolation system would work for prefabs and prefab isolation editing, so if part of a nested prefab is tagged and you isolate to that tag, only that nested part would be actively editable. Could be useful for more complicated prefabs.

    Another point that was brought up that my Art Director really likes is something akin to what Blender 2.8 is doing with view layers and collections. I haven't looked into this as thoroughly, however.

    EDIT:
    Just took a deeper look at the blender blog post and what they have is effectively the tag system I described. I feel that cribbing their notes is the way to go as Collections is less loose conceptually than "a tagging system".

    The main way to go with this in any case is that collections wouldn't affect the hierarchy (indeed, a parent object could be on one collection and a child could be in another), they're only for organization.

    A different chunking system would probably be warranted for open world / large scenes, although my game's use case is a 2.5D platformer that alternates from open-air city backgrounds to large interior levels, with a few narrower spaces thrown in to bridge spaces (or hide transitional loading if need be).
     
    Last edited: Oct 11, 2018
  14. hard_code

    hard_code

    Joined:
    Aug 29, 2013
    Posts:
    238
    "Everything is a Scene" is the only thing I miss from Godot. I saw someone bring up the OP's point at a Unite talk maybe a year ago or so and one of the head Unity guys came across as very dismissive of the idea (probably for valid reasons at least how it relates to unity).
     
    Flavelius likes this.
  15. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    Aren't prefabs scene assets, now?
     
    Sluggy likes this.
  16. hard_code

    hard_code

    Joined:
    Aug 29, 2013
    Posts:
    238
    Well there is still the difference between Scenes and Prefabs in unity. In Godot there is no prefabs only scenes. So unity still has not taken it as far as the OP is suggesting.

    Edit: I guess you could maybe have one root scene prefab and everything nested underneath in unity to pull off what Godot does. Still need more experience with the new prefabs though. I find them confusing so far.
     
    Last edited: Dec 10, 2018
  17. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    Right but Godot is not unity, nor is it completely capable of everything unity can do.

    The OP would be more on point by saying "I can do everything I can in unity in Godot using scenes for everything, for the scale and use cases that I use it for" - which ofcourse does not mean it will be the same for everyone.

    There certainly is a place for prefabs seperate of scenes, and anyone who builds complex editor toolsets etc will sorely miss the exclusion of prefabs, just so that Godot users have less of a learning curve.

    I like what Godot does, but this is not the same engine and I really dont think unity has a lot to gain from learning from Godot.

    EDIT: there is also nothing stopping the OP from not using prefabs at all, and putting everything in scenes and using just those, so I certainly dont see why we would want to regress and remove the abstraction of prefab < > scene.

    Also, scenes have lighting data and other data, which is nonsensical to store for a lot of stuff. Sometimes you just want a collection of stuff < > data, which is what the prefab system does very nicely. Now with nesting, anything can inherit from the original blue print, making organisation very easy also.
     
    Last edited: Dec 11, 2018
  18. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    945
    If the Resource loader allowed async loading of assets/Prefabs like it's possible with scenes then i think storing the gameworld inside nested prefabs could actually be a good workflow.
     
    MadeFromPolygons likes this.
  19. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    You can do this now:

    https://docs.unity3d.com/ScriptReference/Resources.LoadAsync.html

    This is what we do currently, and its a very good way for loading fragmented worlds without big frame drops
     
    Flavelius likes this.