Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Toggling scene visibility for hidden game objects in editor not working?

Discussion in 'Editor & General Support' started by evyatron, Mar 1, 2023.

  1. evyatron

    evyatron

    Joined:
    Jul 20, 2014
    Posts:
    132
    Hello,

    I'm trying to create a temporary hidden Game Object in an Editor script, using the hideFlags:
    Code (CSharp):
    1. m_previewGameObject.hideFlags = HideFlags.HideAndDontSave;
    That works, however it's then visible in the Scene. So instead of just placing it somewhere random (e.g. position = Vector3.up * 1000.0f) I thought I'd use the Scene Visibility Manager to hide it:
    Code (CSharp):
    1. SceneVisibilityManager.instance.Hide( m_previewGameObject, true );
    However that doesn't seem to work. The same line works if my preview object is NOT set to "Hide" using the hideFlags. I also tried using the Scene Visibility before or after setting the hideFlags, to no avail.

    Is this expected behaviour?
     
  2. konstg

    konstg

    Joined:
    Sep 30, 2019
    Posts:
    1
    Hello,

    Did you resolve the problem?