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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    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?