Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Official Scene Visibility Tools - Info and Discussion Thread

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

  1. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Also, are there any plans for streaming scenes to show up / hide automatically (in the hierarchy/vis list) when streaming, particularly when around / far away from the camera in-editor?

    This is killing me in developing streaming games in-editor.
     
  2. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    @PiezPiedPy sorry for the late reply, I seem to have forum notification issues. You would have to do that yourself, with setting the HideFlags, and turning off the renderers. What are you trying to do ?
     
  3. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    957
    Hi! Just had a chat about this, seems like a good plan to add a preference for how SceneVis is saved (or not). Something like "Clear SceneVis data: (Never; Only when I close Unity; Whenever I close a scene)".

    Will look into when we can add this, thanks for bringing it up!
     
  4. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    957
    I don't think we would handle this ... though the SceneVis system might be involved ... I would ask in the Editor General section :)
     
  5. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    Hey, in the mean time you could call SceneVisibilityManager.ShowAll at the appropriate times, or delete the SceneVisibilityState.asset at the root of your Library folder
     
  6. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    Could you give some more details on your problem ?
     
  7. Adrien-TA

    Adrien-TA

    Joined:
    Jan 11, 2019
    Posts:
    7
    @gabrielw_unity Thanks for looking into that ! Those options seem to cover our needs, we will wait for them.
    @neil_devine I'm not confident in erasing Library stuff at runtime =D but the alternative of calling ShowAll on a callback like EditorSceneManager.sceneOpened sounds like a good idea, I will give it a try.
     
  8. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Sorry for the delay --

    So basically, when I am designing maps for a streaming world game (whether it is a 2d or 3d game), I generally have an area of the map that I am working in, but rather than working in one place at a time, I tend to work all over the map at once (using my plugin, Snapcam, to navigate me around the world instantaneously). Getting around the scene this quickly inherently means that I must show/hide/load/unload any distant scenes manually.


    The problem with this is that, whenever I instantly "snap" to a new position in the world so that I can edit the objects there, I have to manually load/unload various scenes / display any hidden objects for performance CONSTANTLY, with no way to ensure what I need to show/hide/load/unload will be taken care of as I arrive.
    Due to these performance issues that sometime crash the editor, I cannot simply use the editor to EDIT my streaming game -- To do this (at least for art), I am forced to use external tools like Blender or Houdini in very non-standard ways to modify my art due to Unity's editor-specific issues like floating point limitations or just general unwieldiness when I'm snapping around these large worlds.
    Ultimately, the area around the editor camera should automatically load new scenes and automatically hide and unload other far away areas (or turn them into imposters after a certain distance, so you can visualize the skyline).


    In general, I would probably want to specify a distance threshold from the camera where scene hierarchies (specified by a master scene) would either display imposters after I move a certain distance away, or be unloaded entirely. When I start back toward this position (within a given threshold) or when I suddenly move the camera there, I would want the scene to be reloaded so that it displays imposters/LODS as I approach it, and then becomes fully detailed after I reach a certain distance from its central origin (perhaps the first gameobject in the scene is the origin of that loaded scene?)

    Positioning in super large streaming worlds gets trickier as the units scale, but using in-editor tools to craft these large worlds gets even trickier (or impossible) with certain long-distance movements beyond a certain threshold. My worlds are getting bigger, and my goto tools are failing me.

    Perhaps handling floating origins in-editor (for visibility/loading purposes) might be an option? -- i.e. if my position is 100,000 km, then the Editor itself sees only a small bit of this at a time, locally around the world origin, which allows users like me who are authoring streaming worlds to use tools like ProBuilder as if they were close to the origin (despite them actually being crazy far away.) Unity would just compress the positioning in chunks of whatever size the user specifies so that these crazy-far-away scenes can be visualized/hidden/unloaded/reloaded and (most importantly) EDITED, whenever necessary.

    Ultimately, showing/hiding scenes/objects for me automatically as I zip around my world is what I want SceneVis to help me do, but the last time I checked, the Editor itself can't do even basic scene positioning when loading a scene (i.e. loading/unloading a scene into/from a specific position in the world). So SceneVis won't work for what I actually need it to do -- especially when it involves editing a scene that has a floating origin (like mentioned above). Unity as a whole assumes I'm just working on ONE single area/scene all the time. Unity assumes that area will never be far enough away from the origin for it to ever matter that using a tool like Probuilder (or other official Unity tools) to design my world at far away distances is actually impossible without the floating origin being recalculated periodically (when the position shifts to far away distances) and assumes I will just make my own tools (i.e. Reprogram Probuilder) for handling such use-cases. However, it is clear to me that these floating origin use-cases are becoming more and more common and I am struggling to keep up with the editor's own scene-management API throughout Unity's progression into a modern editor. MegaCity is a lot to digest, for example, but doesn't handle the floating origin visibility scenario.

    I know that visibility options and better hierarchy management is the purpose of SceneVis tools, but visibility is even more important with a streaming world -- especially one with a floating origin -- because one needs the tools to visualize it in-place and manage it even more carefully than a standard-fare portal-based / static world.



    My only options for this kind of visualization in Unity is to work on every single area of my game (i.e. using Probuilder) near the origin, never being able to fully visualize the connected world as it really is, OR always rely on third-party modeling programs like Houdini or Blender to see the meshes properly positioned and semi-connected (but with complicated visibility scene-loading setups in the modeler (that would be better-off programmed once in the game engine instead) with the inaccuracies of all the wrong materials/lighting due to it not being in-engine. Otherwise, we must duplicate work.
    So far, the only "solution" (to the in-game streaming at least) is the very "iffy" (and dated) (and poorly documented) World Streamer asset that can only do so much anyway when it, too, struggles with the editor's mandates on positioning/loading/visibility.
    In the end, all I really need is to show/hide/load/unload things at the proper moments, and display them in the correct places so I can visualize them (usually following some kind of square or hexagonal grid formation).
    This process seems so fundamental for a modern game engine, but I can't help but wonder why is process this is SO overlooked by third-party game engine development teams? -- Do I really need a separate game engine for the single mundane purpose of simply showing/hiding/unloading the things I need to show/hide/unload at a given moment just so I can EDIT the world?
    This is all distance-based visualization stuff that Unity should already do for me, especially as streaming games with streaming assets have been (and continue to be) the norm in the same games industry that aims for hyper-realistic realtime graphics. The heavier the graphics, the more burden it puts on the editor.

    This is killing me. :/

    I just want to be able to move around and work in the Editor freely and not have it die on me!

    Making games is tedious enough, but with the editor itself not being able to do its own job without my assistance... This gets unnerving to say the least... SceneVis should (inherently) be about helping to maintain both performance and flow (as should all parts of the Unity Editor!) But as far as I see it, when it comes to either performance OR flow, with editing streaming game worlds, Unity's editor doesn't have a clue about all the problems and headaches conjured up by the single issue of basic visibility in streaming world workflows, and developing tools willy-nilly to solve editor visibility without fully considering these issues is a recipe for disaster. I just want to use Unity's official tools to let me visualize / edit the materials/objects across my scenes (with usable performance!) wherever they may be, while being able to zip around my game world as I see fit.

    This really should not be too much to ask. Who knows which team is on it -- either way, you guys seriously still need to __work together__ to make a usable in-editor workflow for streaming game world visibility.



    TL;DR:

    If you don't have time to listen to my amazingly well-spelled-out frustrations, you probably should skip this anyway. lol This is mainly just for the Unity dev who asked me to clarify the problem, so I'm offering as much clarification / details as I feel is necessary to spell out the significant pains I am going through (while also offering potential solutions). This is, after all, a discussion thread. There's lots to discuss.

    :)

    And if you read this, thanks for taking the time! -- These kinds of workflows seriously need to be addressed. Games are only going to get larger. Unity will be so much better for it in the end.
     
  9. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    Hi, thanks for the detailed response. I totally see your point with problems editing large streaming worlds, and how some tools do not perform as well when far from the origin. We have been improving these lately, but for the ones we may have missed, I encourage you to enter bug reports and post them in the WorldBuilding forum or send to me directly.

    SceneVis was not designed or intended for use for any kind of performance improvement or streaming visibility management. It was designed to help users hide away things getting in the way of editing other things.

    As for streaming management, admittedly it is very specific to each game, requirements can be vastly different. We provide the basic building blocks from which you can build your own tailored solution, but as you say there is a lot to discuss on this subject, I believe this merits its own thread in this forum.
     
  10. Esc_Maleficus

    Esc_Maleficus

    Joined:
    Jun 3, 2019
    Posts:
    1
    Quick question: I'm using "SceneVisibilityManager.HideAll" in a script to hide all objects in the Scene view.

    This works fine, except when I hit the Play button. If the game is running, and I click over onto the Scene tab - all of the hidden objects are now rendering, even though they are all marked hidden in the SceneVis.

    Clicking the Hide/Show eyeball in the object hierarchy has no effect as long as the game is running. If I shut the game down, then the settings are respected again and the objects will disappear as expected.

    Is this intentional?

    Is there a work around to get the behavior I'm looking for ( if I hide objects in the scene view, they stay hidden regardless of whether or not I'm playing the game ).

    Thank you!
     
  11. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    There is a limitation whereby if your scene has never been saved (no id associated to it), switching to playmode will render all objects visible. This should not happen if you have saved your scene at least once.
     
  12. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    957
    Hey @awesomedata ! Would you be okay if I move this discussion to a separate thread? It's larger than just SceneVis, and I'd like to avoid this thread losing it's focus, and also avoid your thoughts being lost in the noise. I'll move it over with a new title, or you can copy paste if you prefer. Thanks!
     
  13. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    That's fine! -- I really don't mind as long as it actually gets seen and discussed!

    Hopefully this didn't come across in a negative way.

    I love Unity and very much appreciate the effort that goes into coming up with and implementing great ideas like SceneVis to handle common issues with Unity. I simply wanted to point out some holes I'm seeing in the thinking behind things like this and offer ideas for ways of thinking about potential solutions. I know I tend to think about things a lot differently than most, but sometimes my insights can be valuable to the right listener. Hopefully that is the case here.
     
    gabrielw_unity likes this.
  14. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    957
    No worries - and done! :)
     
  15. stephero

    stephero

    Joined:
    Feb 8, 2016
    Posts:
    121
    Hi guys,
    I am having some issues with the picking and visibility flags: they don't work for GameObjects with editor flags HideFlags.DontSave.
    I tried using both the hierarchy windows and the scripting API.
    Why is that, and is there any workaround?
    Thanks
     
  16. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    Hi !
    The persistent part of the system requires the objects to be saved and therefore induces this limitation. There is no workaround that I know of unfortunately.
     
  17. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    My major question is -- are we supposed to be deprecating the HideFlags from our workflows?
    What are we working toward to use to replace their use in our projects?
     
    Last edited: Jan 24, 2020
  18. stephero

    stephero

    Joined:
    Feb 8, 2016
    Posts:
    121
    Thank you for the information.
    It's quite a shame :(
    I hope it would be possible to control these flags on DontSave objects (very useful for procedurally generated objects) someday, without the persistent part of the feature.
    Thanks
     
  19. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    We will investigate the feasibility and how much users value the persistence
     
  20. stephero

    stephero

    Joined:
    Feb 8, 2016
    Posts:
    121
    Thanks for your understanding.
    In my usecase, I don't care about persistency for DontSave objects, since the DontSave objects are all children of a persistent one. So basically I would like to be able to control the visibility/picking flags of the DontSave sub-objects from my root persistent object using the visibility and picking events from the API.
     
    awesomedata likes this.
  21. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    Did a preliminary investigation, looks like it could be possible to remove this limitation in its current form. Please enter a bug if you don't mind, it will help us both track the progress.
     
  22. stephero

    stephero

    Joined:
    Feb 8, 2016
    Posts:
    121
    Thanks
    Bug has been reported with ticket ID 1217361.
    Cheers
     
  23. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    513
    @gabrielw_unity @neil_devine We're testing updating from 2019.2 to 2019.3 and hit the scene picker not working in the DontDestroyOnLoad scene - the setting is ignored and things are pickable all the time.

    The picking in DontDestroyOnLoad problem was mentioned in a previous post (#141). Did this happen to be bug reported and/or fixed? Thanks for any info.
     
  24. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    Hi @greg-harding I have not seen this come through and cannot find it in the bug database, if you could go ahead and report this we will get to it as soon as possible.
     
  25. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    513
    Hi Neil @neil_devine, thanks for your quick reply. I submitted a bug a few minutes after your post. I haven't had an email/confirmation of it but ***Updated it did finally appear in fogbugz. Case #1234777
     
    Last edited: Apr 8, 2020
  26. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,732
    Hi,
    I'm trying to use SceneVisibiltyManager on a number of objects to disable picking in the editor but I'm getting a few errors on the way.
    I have this on each script -
    Code (CSharp):
    1. if (sv == null)
    2. {
    3.     sv = ScriptableObject.CreateInstance<SceneVisibilityManager>();
    4. }
    But I'm getting an error ScriptableSingleton already exists. Did you query the singleton in a constructor?
    Am I approaching that wrong? It works okay as is but the errors are slightly disconcerting.

    Thanks,
    Pete
     
  27. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    Hi @petey the reason you are getting this error is because the singleton for the manager is created and managed by the editor, there can only be one. You should be using that singleton to do your operations. You can get access to the singleton through its instance:

    SceneVisibilityManager.instance


    You will then have access to all the methods you need like

    SceneVisibilityManager.instance.Hide(...)

    SceneVisibilityManager.instance.Show(...)


    or if you want to disable just picking and still see your object

    SceneVisibilityManager.instance.DisablePicking(...)
    SceneVisibilityManager.instance.EnablePicking(...)
     
    awesomedata and petey like this.
  28. alexovi

    alexovi

    Joined:
    Dec 14, 2012
    Posts:
    1
    @neil_devine, just for curiosity. Why have you started using the singleton patterns? In past all 'singletons' were implemented just with static methods.
     
  29. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Because he is a fan of "The Highlander" and the above explains it all.
     
  30. Ludiq

    Ludiq

    Joined:
    Mar 6, 2015
    Posts:
    773
    Hi!

    I'm trying to have a custom camera cull the objects hidden via the scene visibility tools.

    (I need to do this because I'm implementing a custom camera mode for the scene view).

    I tried the following but I can't seem to get it to work:

    Code (CSharp):
    1. var camera = // my custom camera
    2. var sceneView = SceneView.lastActiveSceneView;
    3. camera.cameraType = CameraType.SceneView;
    4. camera.scene = sceneView.camera.scene;
    5. camera.overrideSceneCullingMask = sceneView.camera.overrideSceneCullingMask;
    Is there any other setting I need to set or other API I could call?

    EDIT: Strangely, this seems to work for my terrain object (the relevant line is setting the CameraType to SceneView), but not for my other renderers. What's the logic here?
     
    Last edited: Jul 14, 2020
  31. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    537
    The visibility flag is only culled in the editor camera drawing render path, so you will need to use Handles.DrawCamera to render your camera instead of the usual Camera.Render. Make sure to set DrawCameraMode to something other than DrawCameraMode.Normal, (ex, use Textured) as Normal mode is treated as a regular Camera.Render call.

    Note - I haven't tested this. There may be additional setup that is not mentioned.
     
  32. Ludiq

    Ludiq

    Joined:
    Mar 6, 2015
    Posts:
    773
    Thanks! Handles.DrawCamera did the trick. :)
    I used DrawCameraMode.UserDefined.
     
    kaarrrllll likes this.
  33. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Hi! I met strange behaviour for scene picking tools caused by prefabs.
    In short, if I disable parent and enable children pickability I still can pick parent if it is prefab.
     

    Attached Files:

  34. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    One more variation of behaviour if nested prefabs after override used.
     

    Attached Files:

  35. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,361
    awesomedata likes this.
  36. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    This sounds like a great request -- but it also would be nice to have a ShaderLODs to (more easily) go with model LODGroups.
     
  37. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    Is there anyway to check the state of this button, or change it's state, via script?


    I was using SceneVisibilityManager.instance.Hide(...) to hide a gameobject but it wasn't working. Now I've found out why, but need to control this option via script. Thanks!
     
  38. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    What would also be handy is a way to "LABEL" said meshes in groups -- and access / hide / show those groups that way (and even handle culling or colliders or other operations based on said labels). :S
     
  39. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,108
    Ho,

    i wonder what happened to Hierarchy Window improvements. It's been almost a couple of years since we gave feedback and requested features which were planned and we still have scene visibility and lock features only !

    Where are the "standard to every software out there" hierarchy window layers ?
    Where are the hierarchy lines ? ( this should be added as an option though )

    Is this the final variant of the hierarchy window ?
     
  40. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,334
    I like this one
    https://assetstore.unity.com/packages/tools/utilities/enhanced-hierarchy-2-0-44322

    and yes it would be nice if unity had this functionally
     
  41. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,471
    I don't know what happened, but I can't seem to get rid of the visibility settings anymore.

    upload_2021-2-22_11-24-43.png

    No matter what I do... clicking on them, alt-clicking on them does not remove its status... I am stuck! Is this bug?
     
    awesomedata likes this.
  42. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    This bug has been there for a while -- What version are you on?


    Also, just to be clear -- are you trying to hide/show an "inactive-but-visible" scene?
     
  43. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,471
    Some of its visibility status in various state cant be changed no matter what I do..

    I think the bug is related to the prefab objects and its childrens..

    I am on 2021.b7
     
  44. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    537
    Does the problem persist if you close and reopen Unity? What about in a new scene?
     
  45. neil_devine

    neil_devine

    Unity Technologies

    Joined:
    Apr 8, 2018
    Posts:
    42
    If you know the steps that led up to this it would be great if you could report a bug. There is a SceneVisibilityState.asset file at the root of your Library folder, if you delete it it will delete all saved visibility state for your project, and should restore you back to a working state.
     
  46. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    683
    My scene visibility "eye" icons are stuck as enabled in each of my 2019.4.23f1 project hierarchies and I do not know how to turn them off. I have clicked on all eye icons but they just stay enabled.

    Is there a unhide all option anywhere?

    The only solution I can find is to reload the scene!
     
    Last edited: Jun 16, 2021
  47. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,471
    I landed up deleting the prefab from the scene and replaced it lost some references but oh well...
     
  48. MeadowGames

    MeadowGames

    Joined:
    Dec 15, 2013
    Posts:
    11
    Is there anyway to disable the scene visibility in the hierarchy all together. Honestly I hate it. It clutters my already cluttered hierarchy and adds an unnecessary layer of complexity to my scene. I'm coming from Unity 2018. All these new features are a drag on my productivity. The old Hierarchy was much cleaner and easier to see. These extra two coloums on the left hand side are just atrocious. Thanks!
     
    CloudyVR and awesomedata like this.
  49. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    870
    I sometimes have the issue that SceneVis breaks on UI elements, meaning it will not hide them.
    Pressing "Shift + H" twice to enter/exit isolation mode usually fixes it but it's a nuisance. Sadly it happens randomly so I have no reliable reproduction case. Anyone having simmilar issues?

    Here is a short video of the "bug" in action:
    https://kamgam.com/unity/SceneVisCanvasBug.mp4
     
    Last edited: May 5, 2021
    awesomedata likes this.
  50. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Wow. I'm surprised this bug is still here. D:

    And yeah -- I've dealt with it before myself. It seems to have something to do with having multiple scenes open at once and clicking on them and trying to show/hide them in weird/unexpected ways by the developers.
    After doing that, the bug sometimes shows up.

    How many scenes do you have (uncollapsed) in the scene hierarchy? -- It seems to happen after collapsing and uncollapsing items sometimes and trying to "hide all" and trying to show or hide individual items.