Search Unity

Resolved Hierarchy Folders

Discussion in 'Authoring Dev Blitz Day 2023' started by CaseyHofland, Jan 26, 2023.

  1. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    613
    Are you planning to add hierarchy folders? I know there's a roadmap for it but it's hard to tell sometimes if it's actively being considered.

    https://portal.productboard.com/ca1chnbwvzw1eg5yjc5rijnj/c/392-hierarchy-folders

    I would really like this feature as a way of improving Unity performance without sacrificing hierarchy organization. I've been using a unity package for it which has a very clean implementation: any gameobject that is a folder can't have other components, its transform is locked at world origin and when your game runs or builds it will remove all folders.

    https://github.com/xsduan/unity-hierarchy-folders

    But I can imagine Unity can do some under the hood stuff to make this even better. All you'd need is a bit of metadata in a gameobject to say if its part of a folder, and if so you display a folder in the hierarchy. It would be purely a UI thing and everything would run nicely both in the editor and at runtime.

    For how easy it is to implement this, and since only root transforms can take advantage of multithreadedness, it's honestly a shame we don't have this feature already.
     
  2. echu33

    echu33

    Joined:
    Oct 30, 2020
    Posts:
    62
    Oh I second this one. Editor only folder inside hierachy is really needed.
    For years too many user use empty game object on the scene as folder to clean the Hierarchy. Leading to the results sometimes we even need to flatten(Delete) out those folder object before building the app. which is time consuming.
     
  3. sebastienlh

    sebastienlh

    Unity Technologies

    Joined:
    Sep 22, 2017
    Posts:
    40
    Hi! The roadmap is correct in this case: it is under active consideration. We are currently working on solving some dependencies to allow us to tackle this feature properly. I'm not going to risk a version number or date, but that is something we definitely want to tackle soon.
     
  4. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    Since there is third party plugins that solve this problem, without having access to any Unity internals, might it be that you're looking at it from the wrong angle? The unity-hierarchy-folders plugin that @CaseyHofland linked didn't have to solve any dependencies!

    Which features is it you want to add to the hierarchy folders that it's impossible to add right now?
     
  5. EricDziurzynski

    EricDziurzynski

    Unity Technologies

    Joined:
    Mar 11, 2022
    Posts:
    53
    Hi All,

    I manage the public editor roadmap and assure you that anything that is there is still actively being considered. Hierarchy Folders is absolutely being considered and high priority for us. As Sebastien mentioned, we are still working on the approach and trying to improve search and organization across the editor in the process.

    I will add your feedback to our backlog for this feature so we don't lose it but in the future if you want to provide direct feedback for features on the roadmap, I encourage you to do so. We review any feedback there regularly and it genuinely helps us prioritize what we work on and our approach.

    Thank you!
     
    jwinn, MechaWolf99 and echu33 like this.
  6. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    613
    The product board has now been updated from "hierarchy folders" to "hierarchy performance and organization"

    https://portal.productboard.com/ca1.../c/392-hierarchy-performance-and-organization

    I'm curious to the motivation behind this. The community has been asking for hierarchy folders - I guess I haven't seen any other suggestions for hierarchy organization so I'm curious what else this entails.

    Regarding those, are there any implementation details yet? In my mind, all you'd need is have the YAML serializer support hierarchy names (so folder "Foo" with GameObject "Bar" becomes "Foo/Bar" for the serializer) and have it display as a purely UI thing in-editor. Result: GameObjects that are part of the root, but collapsible in the hierarchy.
     
  7. sebastienlh

    sebastienlh

    Unity Technologies

    Joined:
    Sep 22, 2017
    Posts:
    40
    Can't speak for the product board change, but I can tell you that we are not yet at a point where we have implementation details to share. One thing we know is that folders are an editor concept that we absolutely do not want to leak into the runtime, and builds are currently long and tedious enough that we would much prefer our solution to not involve any kind of post-processing or stripping.

    That is also somewhat hairy / non-trivial. Nothing in the current hierarchy allows us to do this: there is no concept of a non-UnityEngine.Object node at all. If we want the hierarchy to be performant at scale, we can't just introduce this concept without other major restructuring. Folders also need to have their custom actions / interactions: cut/copy/paste, drag and drop, nesting, creating/deleting, select/inspect, rename; which also all need to be performant at scale, ruling out string-based folder paths.

    Earlier, I mentioned that we are working on solving dependencies for folders and this is part of it. A dependency being the ability to efficiently display non-UnityEngine.Objects in the scene hierarchy, be they Entities, folders, or something else. Then we can start tackling folders without having to hack them in.

    We're keeping our options flexible. Maybe we want something collection-based instead that may or may not be overridden per-user, for example. I'm partial to good old folders myself to be honest, but I'm not willing to shut the door on other explorations.

    Hope this helps!
     
    jwinn and CaseyHofland like this.
  8. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    613
    Glad there's being so much thought put into it, I had no idea there were so many strings to it (in my defense, folders seem trivial from a users perspective).

    One problem I'm having with the github package is Prefabs with a folder at the root: since folders delete themselves, it would turn 1 prefab into x game objects, which is obviously impossible.

    One solution I would like to propose is that prefab instances (existing in the scene) delete the folders, but prefabs themselves turn the folder into a normal transform. We use prefabs with folders as these kind of "packs" (e.g. the Player Pack contains the player prefab, the camera prefab and a cinemachine freelook prefab). I'd imagine open world games would like to use it for recurring geometry too, where the folder-problem becomes more significant.
     
  9. sebastienlh

    sebastienlh

    Unity Technologies

    Joined:
    Sep 22, 2017
    Posts:
    40
    In our current plan, folders could not be the root of a prefab as they would not be UnityEngine.Objects. But I'm glad you're bringing this use-case up. I don't think we should allow it, but we will at least consider it. If it's something you would want, could you tell me why this is important to you / what kinds of workflows it would open up? Thanks!
     
  10. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    613
    As I call them, Prefab Packs. 1 prefab that packs a bunch of different objects but otherwise does nothing else: just like a folder. I'm not a fan of singletons (put mildly), but where I have seen them used there's always that 1 prefab in every scene hosting them.

    This of course expands to stuff like recurring structures or room layouts, however feng shui they may be. These just pack into prefabs so neatly. Then again, in 98% of games these will likely end up as static geometry anyway, so fair's fair: this feature is kind of nitpicking.

    Thanks for responding so quickly and transparently, I really appreciate it!
     
    sebastienlh likes this.
  11. sebastienlh

    sebastienlh

    Unity Technologies

    Joined:
    Sep 22, 2017
    Posts:
    40
    I've bookmarked this thread to refer to once we're at the point of making those decisions. I will probably have more questions about that specific workflow at that point.

    Thanks for your input!
     
    CaseyHofland likes this.
  12. mads5606

    mads5606

    Joined:
    Oct 13, 2022
    Posts:
    1
    Appreciate the input on this, is there any updates?
     
  13. sebastienlh

    sebastienlh

    Unity Technologies

    Joined:
    Sep 22, 2017
    Posts:
    40
    Hi! For a bunch of reasons you could infer (from the news, or twitter, or the forums), this is not currently our focus. It won't be part of the next Unity release, but I can't imagine us not doing it eventually. Wish I had a better answer for you on this.