Search Unity

Custom editor window - how to hide 'editor' stuff from the scene?

Discussion in 'Scripting' started by imaginaryhuman, Nov 15, 2021.

  1. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Let's say I want to build a custom editor window. And in this window there's a large area which is to show realtime graphics. And these graphics should be constructed from animated meshes, textures, render textures, depths sorting, shaders, transparencies etc.... ie like a 'scene' within the editor. But let's say I want to keep this stuff SEPARATE from the user's project/hierarchy, and not mess with or clash with their use of unity, how do you do that? Like, if I use a camera wouldn't the camera show up in their scene? And if I add custom meshes to be displayed, would those meshes then show up in the user's project or hierarchy or scene? How and where do I locate the scene in 3D space, it supposed to be 'off camera' or something so that it doesn't show up in the regular scene view?

    Like for example Unity has the shader graph editor with fancy boxes and connectors and so on and its pretty performant. I don't want to be using 'handles' to draw lines and all that kind of stuff because it's extremely slow. I want to just have a custom scene with custom meshes and shaders and stuff which gets output in some way and ends up in my editor view, without "cluttering" the user's scene or interfering with their work. If I set up a camera, with a layer, am I not going to be fighting with the user's use of the layers? If I set up meshes to be displayed, are they not going to show up in the user's scene somewhere?

    Generally how do you keep a complex realtime graphical scene, in a custom editor window, separate from and not conflicting or tangled up with, the user's regular files and objects and settings?
     
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Something related to this maybe? https://docs.unity3d.com/ScriptReference/HideFlags.html

    A
    lso if I need to create meshes, gameobjects, cameras etc as part of the editor, would these show up in the project/hierarchy.... or like, do I add them there but HIDE them there so the user doesn't see them?
     
  3. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Like, say I use UIToolkit and the UIBuilder... and I make a gui, and have a texture image as a background, and use a rendertexture to output to this texture ...... how can I render 'a whole scene' that is not the user's scene, comprising meshes, shaders, animation, realtime updates etc.... without interfering with the user's files or scene data or confusing them with 'internal editor files' that they're not supposed to see?
     
    Last edited: Nov 15, 2021