Search Unity

Official Scene Visibility Tools - Info and Discussion Thread

Discussion in 'World Building' started by gabrielw_unity, Dec 5, 2018.

  1. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hi all! Don't worry, we know that customization is very important. This is why we'll ensure there is an API that everyone can make use of, especially folks like "Hierarchy Plus" and so forth, so that your favorite ultra-custom Hierarchy extensions can make use of everything we create.

    On the other side, it's important that there is a clean, functional default that users can start with, which will be our implementation.
     
    Lars-Steenhoff likes this.
  2. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526
    Cool thats good to know!
    I hope I can also disable it if I don't want to use it and claim back the extra space on the left side of the hierarchy.
    Because I use mainly one of the mentioned plugins.
     
    gabrielw_unity likes this.
  3. DonkeyPotato

    DonkeyPotato

    Joined:
    Mar 23, 2018
    Posts:
    28
    Is there any timeline on the API being available? I just grabbed 2019.1 for terrain stuff and was very pleasantly surprised to find the SceneVis controls. This is a fantastic addition.

    I've got some cobbled together editor code to hide UI objects / show 3D objects and vice-versa depending on whether the editor is in 2D or 3D mode, and being able to script it via the SceneVis state would greatly simplify it.
     
    gabrielw_unity likes this.
  4. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    +1, kind of surprised it shipped without an API? We can't get our custom tools to work with the new visibility tools, so when you hide everything there is still a bunch of stuff visible. Will we see an API in 2019.2...?
     
    gabrielw_unity likes this.
  5. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hi all! Yup, API will be 19.2, looking forward to hearing how you make use of it!
     
  6. shredingskin

    shredingskin

    Joined:
    Nov 7, 2012
    Posts:
    242
    Is there a behavior that "locks" the invisible items from being clicked on scene view ?
    I mostly use this feature to hide a big UI canvas, so it's kinda frustrating to be still be able to click on it.
     
    Lars-Steenhoff likes this.
  7. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526
    @shredingskin
    I recommend this asset:
    https://assetstore.unity.com/packages/tools/utilities/sceneview-highlight-and-pickup-109667

    It allows you to select objects behind UI canvases and therefore you don't even need to hide it anymore.

    But if you still want to lock items I can recommend this tool.
    https://forum.unity.com/threads/dockable-layers-window-open-source.581179/

    Where you can lock the whole UI layer


    @gabrielw_unity If this kind of functionality can be built into unity it would be very nice.

    These assets save me a lot of clicking
     
    Last edited: Apr 26, 2019
    shredingskin likes this.
  8. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526
    Also there is locking objects on the roadmap for 2019.3

     
    shredingskin likes this.
  9. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hi! That's a bug- sorry, it's logged internally and should be fixed soon :)

    Locking: yup, this is the clear "sibling" for Vis, working toward it ASAP!
     
    Last edited: May 1, 2019
    shredingskin and Lars-Steenhoff like this.
  10. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526
    Will you also make grouping an item on the todo list?

    where one item can be a child of multiple selection groups.

    Like the asset "pro groups" was before, That was so powerful.
     
    gabrielw_unity likes this.
  11. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Yup! We're calling that "Selection Sets" and I really hope we can get it done soon. Agreed, it's a must-have, probably very similar to the old ProGroups, but more tightly integrated with the Hierarchy now :)
     
    Lars-Steenhoff likes this.
  12. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526

    Great to hear!

    and please have a look at the shelf, this asset has quickly become my favourite in every project.
    https://assetstore.unity.com/packages/tools/utilities/the-shelf-2904
    because it can hold hierarchy items but also project prefabs or even folders. very powerful.

    Also I made a little test to have buttons for layout switching, this also is very powerful.
    Alternatively with keyboard shortcuts, but the mouse is sometimes quicker.
    Perhaps this can be a native unity option. I'm sure many artist who for example have to switch between animation or level editing would love this
     
    gabrielw_unity likes this.
  13. Ofx360

    Ofx360

    Joined:
    Apr 30, 2013
    Posts:
    155
    Figured i would bring it up that while you can hide a Canvas/UI, all canvas items still seem to be selectable.
     
  14. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, i quickly went through the thread, so just a quick question.

    As i understand we should be seeing SceneVis as a downloadable package in the manager at some point may be soon may be not !

    Is that correct ? Thanks !
     
  15. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Thanks! Should be fixed in the latest version :)

    Incorrect! :p

    It is built into 19.1+ :)
     
  16. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Ah OK. I thought SceneVis will be more feature rich tool that will add more functionality to the Hierarchy window .
    Currently the options for toggle object visibility is a separate tool which is already available and later we will get another tool with more options or is it this tool going to provide more options later then ?

    I am mainly looking into being able to lock objects.
    What about in editor only layers - instead of creating empty game object and attach objects to it.

    Where can i read about what options are planned !?

    Cheers :)
     
    Lars-Steenhoff likes this.
  17. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Baby steps! Simple vis toggles and isolation was the starting goal, and testing out the extra column. 19.3 has "lock", although it's really a "ignore scene picking" toggle, just like the Layers drop-down currently works.

    Speaking to your mention of Layers/Grouping, yes! We have a "Selection Sets" feature also planned, tentatively around 2020.1, should enable you to group items without modifying hierarchy, perform actions (like hide/lock/etc) to those groups.
     
  18. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Happy :)
     
    gabrielw_unity likes this.
  19. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,336
    Hi,
    just wanted to ask if the Editor API for SceneVis is the newly exposed "SceneVisibilityManager" class?
    2019.2 API Docs: https://docs.unity3d.com/2019.2/Documentation/ScriptReference/SceneVisibilityManager.html

    I've tested it in 2019.2.0b10 and it seems to work like this:
    Code (csharp):
    1. if ( SceneVisibilityManager.instance.IsHidden( theGameObject ) )
    2. {
    3.     // do something with a hidden object
    4. }

    @gabrielw_unity Maybe you could add this to the Google Doc documentation for easier discoverability (took me a while to find it).
    GoogleDoc: https://docs.google.com/document/d/13OeZgflRzhJMoPWlJ6D7yuz2gDlNQaLJ_pCgdT517uQ/edit

    Is there a recommended way to call these APIs in 2019.1.x releases, since now there is a gap between availability of the feature and API access.

    Why am I asking? I'm an asset developer making selection improvements assets (Smart UI Selection) and I suspect some users will be confused by my tool selecting "hidden" items in 2019.1 (wrong) but not 2019.2 (right). To be clear, I just want a way to detect whether or not an object is hidden in 2019.1.x. SceneVisibilityManager is not exposed in 2019.1. Can we use/call it with reflections or do you discourage such behaviour?

    Thanks,
    Georg
     
    Last edited: Jul 22, 2019
    tokar_dev likes this.
  20. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,336
    For those interested, here is the full code for hidden detection in 2019.1.x and 2019.2.
    Use it at your peril ;-)

    Code (csharp):
    1.  
    2. #if UNITY_2019_2_OR_NEWER
    3. if ( SceneVisibilityManager.instance.IsHidden( theGameObject ) ) )
    4. {
    5.    // Do something with hidden objects in 2019.2 and above
    6. }
    7. #elif UNITY_2019_1
    8. // Sadly the SceneVisibilityManager API is not available in 2019.1 (SceneVis was introduced in 2019.1)
    9. // We can use reflections to get this info in 2019.1
    10. var editorTypes = typeof(Editor).Assembly.GetTypes();
    11. if (editorTypes != null && editorTypes.Length > 0 )
    12. {
    13.    var sceneVMType = editorTypes.FirstOrDefault(t => t.Name == "SceneVisibilityManager");
    14.    if (sceneVMType != null)
    15.    {
    16.        var sceneVMMethod = sceneVMType.GetMethod("IsGameObjectHidden", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
    17.        if (sceneVMMethod != null)
    18.        {
    19.            var isHidden = sceneVMMethod.Invoke(null, new object[] { theGameObject ) });
    20.            if (isHidden != null && (bool)isHidden)
    21.            {
    22.                // Do something with hidden objects in 2019.1
    23.            }
    24.        }
    25.    }
    26. }
    27. #endif
     
    Arkade, seandanger and gabrielw_unity like this.
  21. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    Hi @_geo__
    Yes

    Yes don't call them :)

    We usually discourage using reflection since APIs and behavior can change and break your code in a way that is not always obvious. Also we have tests on public APIs whereas we don't necessarily have coverage for all internal functions, and finally it may be that some functions are not supposed to be called in certain contexts.

    That said your code seems to manage the API change correctly, and behavior has not changed between those 2 versions.
     
  22. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,336
    Thanks @neil_devine for the confirmation and the insights.

    Quote: "Yes don't call them"
    Yeah, I don't like using reflections at all but I rather take that risk than face the wrath of my asset customers ;)
     
  23. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    @gabrielw_unity or @neil_devine

    Can one hide/show only a select few gameobjects in an otherwise hidden scene yet?


    Essentially, this would be sort of a "compressed" view of a scene rather than a fully-hidden scene.

    This is WAY more useful to me than fully hiding everything in the scene itself.
    Perhaps SHIFT+left-click (or a right-click option) would be a better way to hide everything at once, while letting us have this "compressed" view of our scenes otherwise?


    Please, please, pretty please??
     
  24. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    This sounds really interesting. Would you say this could be the long-awaited and often requested "folder in the hierarchy" feature? Would a selection set group items in the hierarchy under a collapsible toggle without using a real GameObject and without breaking transform.GetChild() etc? If so, this is great news! :)

    Other than that I wanted to add, that I'm looking forward to the API. I'd like to use it for custom tools, which may also help in tasks such as sprite sorting. For example, I hope that it's possible to create visibility requests such as "show all SpriteRenderes within the foreground layer and between sorting order 0 to 500".
     
    awesomedata likes this.
  25. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    I think "Isolate" might be what you want? That's one of the best features of SceneVis :) Try it out! :)

    "Selection Sets" are an upcoming thing, we are hoooping 2020.1, but can't promise. That's shifting around quite a bit. Better than a Hierarchy folder, it would be a non-hierarchical organization tool, for creating "sets" of items both manually and via "smart sets". The benefit to being non-hierarchical is that any item can belong to multiple Sets, and you can place Sets inside other Sets ... plus no more mucking up your scene's parent/child relationships :)
     
  26. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Is that when you click on an eye icon for a gameobject in a hidden scene? -- If so, how do you toggle that via the UI?

    I see there is a shortcut (that isn't set) for this functionality, but is there no right-click menu or "hold this key" shortcut and then "click on the eye icon" to toggle visibility of the isolated objects.


    Am I missing something? -- This definitely sucks for discoverability. D:



    You got me. Do this right though. Please. Do this right. :)


    We definitely need this to work well for huge endlessly-streaming worlds without having to jump through hoops to keep performance. D:
     
    gabrielw_unity likes this.
  27. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    awesomedata and Xarbrough like this.
  28. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Isolate seems like a missed opportunity to have working with the icons in the hierarchy. By requiring a hidden buried shortcut to actually access it, its discoverability is essentially reduced to zero. Surely a toggle shortcut or a right click menu popup from the eye icon would aid in its discoverability? Seems like a waste to hide such a cool and useful feature away from users in a hidden shortcut.

    How else would any user even know this functionality exists? It's not like there's any real explanation of the shortcut in the shortcut manager...

    Either way, thanks for pointing this stuff out to me. I never would have found it without you pointing it out so explicitly. You guys definitely need a pop-up menu for the default hide/show to be isolate mode on/off.

    Also, isolate should only apply to the scene(s)/object(s) you've select to be isolating. Think MegaCity or streaming scenes/worlds -- Many of us will prefer to isolate only individual scenes/gameobjects for very heavy scenes, while choosing to display in full the ones we are otherwise working on.

    Just something that would be very helpful. D:
     
  29. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hi! Yep, we would have liked to add a visual method, but we had some troubles getting things out the door on time. There will definitely be a visual, discoverable method in the future ... saddens me to know that most people won't actually find the best part of that feature :p

    Isolate only selected: can you explain? It should do that, in theory. Well - selected items and their children. Originally we went with "ignore children" but there was immediate confusion from that, so we swapped to "selected + children".

    Err, wait - do you mean, if you have multiple scenes loaded, and Isolate an item from Scene A, Scene B remains totally visible?
     
  30. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Fair enough! -- I hope that people see this exchange at least. Despite its lack of discoverability, I was pleasantly surprised to find the shortcuts for this functionality. The very fact that this exists shows your team was definitely on the right track! :)



    So basically, with 70 scenes loaded, I want to only show some of the 15 I am close to while I am authoring three or four of them together. There are times when I only want to show the mountains (and maybe a structure) in a very far away scene or three (to set up a particular distant in-game shot, for example) while sculpting my terrain in a particular location in my world. All other scenes I want to stay hidden (except for the ones I'm working on far away from the reference scene or three I'm setting up the shot with.)

    Being able to edit these isolated versions (or hide them entirely) via an API as you get closer or farther away from them can be vital for something like this too because, as you're moving across a really large world, fully hiding some of these would be necessary as the scene camera moves farther away.

    Ultimately, isolating (or showing/hiding) ten or fifteen different scenes (out of all 70) and a few of each scene's visible gameobjects should be as easy as clicking a button or calling a script via shortcut (i.e. to show/hide all scenes not near to the scene camera, or to toggle isolation mode on those scenes near the camera).

    Hopefully this makes sense!
     
  31. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hmm, yep, this would be a good use of the API :) Have you looked into that? Sorry, I wouldn't be of use on that, just UX/art :)
     
  32. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Sure, I wouldn't mind digging into the API a bit. However I wouldn't know where to start in modifying the hierarchy icons and their behavior. Like you, I'm mostly an art/design guy and aren't familiar enough with the API to be that useful with it.

    Maybe you could find someone to point me in the right direction?
     
  33. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
  34. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    :(

    I guess isolating scenes is impossible -- only gameobjects in a particular scene can be isolated, not scenes as groups.

    That explains why isolation mode wasn't doing what I expected across multiple scenes...


    Ever since Megacity, it really seems like we should be able to treat scenes as groups...
    ...which should include visibility/isolation on a per-gameobject level...
     
  35. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hang on, I might have misunderstood - and this looks like a bug - if I select a Scene and "Isolate", everything is hidden, including all the objects in that scene. The scene itself should definitely be treated as isolate-able, just it can be hidden/shown all at once. I'll get a ticket created for that ASAP, thanks for bringing it up!
     
    awesomedata likes this.
  36. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    197
    Please add layers for asset like in any 3d software like 3ds max, maya, blender, cinema 4d and etc. We need to layering our assets in scene. The existing physics layer ISNOT appropriate for this kinda things cuz if we add separate layer for each group asset physics layers matrix became impossibl large and uncontrollable.
     
    Lars-Steenhoff likes this.
  37. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526
    Yes I would love layers too, like in blender 2.8 / Maya
     
  38. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
  39. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419

    Indeed, me too.
    And I rather like Blender's "Collections" label for them because, well, that's quite accurate for what it would be -- a "Collection" of things. "Layer" is somewhat of a misnomer (works for Photoshop since you're layering filters/etc. to modify the final image's appearance, but it actually falls a little flat for 3D since you're more likely just showing/hiding things -- i.e. "Collections" of things.)



    @gabrielw_unity:

    -- Since Nested Prefabs are somewhat like Nested "Collections" of things (like they are in MegaCity) and the way I would want to use SceneVisibility would be to show/hide some of these nested things in groups, would it be possible to automatically associate SceneVisibility "Collections" with certain NestedPrefabs? (i.e. I work out a layering mechanism I like within a NestedPrefab, save that prefab, then automatically generate a new "Collection" with that layering setup that I can turn on/off with SceneVisibility tools and API.)

    Would this be in the cards?

    This could also be an opportunity for a more general (and performant) "Collection" mechanism. For example, I can use this for grouping certain bones I want to pass to the new procedural animation jobs system. The same group can be used by the SceneVisibility tool to show/hide some of these bones in the view.
     
    Last edited: Aug 29, 2019
    Lars-Steenhoff likes this.
  40. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Hey folks! Yes, an organization system is in the works, similar to Blender's "Collections" :)
     
  41. samfisher-cf

    samfisher-cf

    Joined:
    Jun 13, 2016
    Posts:
    5
    Seems like scene vis does not work for objects in the DontDestroyOnLoad scene. (I know its usage is discouraged, but that's currently how our system works and are too far along to change it now.)
     
  42. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Thanks Sam- could you file a bug report for this? Thanks!
     
  43. PiezPiedPy

    PiezPiedPy

    Joined:
    Mar 22, 2019
    Posts:
    14
    When I hide a GameObject with SceneVisibilityManager and also set HideFlags to Hide the GameObject from the Hierarchy the GameObject reappears in the scene. (Unity 2019.2.6f1)

    Code (CSharp):
    1.             if (OutputObject == null)
    2.             {
    3.                 OutputObject = new GameObject("GeneratorOutput", typeof(MeshFilter), typeof(MeshRenderer));
    4.             }
    5.  
    6.             SceneVisibilityManager.instance.Hide(OutputObject, true);
    7.             OutputObject.hideFlags = HideFlags.HideAndDontSave;
    8.  
    9.  
     
  44. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    Hi @PiezPiedPy this is expected behavior, SceneVisibility ignores objects hidden with `HideFlags`
     
  45. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526
    I still look for a way to turn off the scene visability tools, I have other tools that do similar and more things, and scene vis tool eats up space in the hierarchy
     
  46. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    lol -- I guess that maybe depends on which chair you're sitting in?

    I feel like 'HideFlags'-endowed objects should be hidden extra-well...
     
    PiezPiedPy and Lars-Steenhoff like this.
  47. Adrien-TA

    Adrien-TA

    Joined:
    Jan 11, 2019
    Posts:
    7
    Hi,
    We recently started using the SceneVis API on our project, to handle some edition toggles, and it works great, thanks for the feature !

    More specifically, we have an editor tool that allows us to hide the level meshes, and display generated gameplay information instead (namely, our gameplay grid). By doing this through the SceneVis API, we avoid modifying the scene asset itself so it's great for safety considerations (we were using renderers enable/disable before).

    Our problem lies with the SceneVis automatic save of its informations between sessions. I can't find a way to disable this behaviour. Designers are often confused when they open a scene and see holes on their maps, and end up systematically toggling off SceneVis manually when starting working on their scenes in the morning.

    I feel like SceneVis is mostly useful when you are working on a specific part of a scene and you want to discard everything in your way. Meaning you only need to hide stuff during this specific working session, and wish to reset the whole scene visibility once you are done, which should be automatic when closing the scene.

    Is there an option planned to control this behaviour ? Can we do something by script on our side to flush everything when opening or closing a scene ?
     
    KarimTA and awesomedata like this.
  48. PiezPiedPy

    PiezPiedPy

    Joined:
    Mar 22, 2019
    Posts:
    14
    @neil_devine So is there any way to hide a GameObject from the Scene and the Hierarchy at the same time ?
     
    awesomedata likes this.
  49. MrAdrenaline

    MrAdrenaline

    Joined:
    Oct 23, 2019
    Posts:
    2
    Thanks for sharing,excelnet write
     
  50. Adrien-TA

    Adrien-TA

    Joined:
    Jan 11, 2019
    Posts:
    7
    @gabrielw_unity Do you know if the option described above (control on the default behaviour of SceneVis when opening a scene) has been considered on your roadmap ?