Skip to content

Instantly share code, notes, and snippets.

@hybridherbst
Created February 9, 2021 15:55
Show Gist options
  • Save hybridherbst/adcd101ca367365dfbf2d576d6a41e6a to your computer and use it in GitHub Desktop.
Save hybridherbst/adcd101ca367365dfbf2d576d6a41e6a to your computer and use it in GitHub Desktop.
Show all objects - disable HideFlags
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
public static class ChangeHideflags
{
[MenuItem("Tools/Show All for Selection")]
static void ShowAllChilds()
{
var t = Selection.activeTransform;
ShowAllInChilds(t.gameObject);
}
[MenuItem("Tools/Show All for Loaded Scenes")]
static void ShowAllChildsInScene()
{
for (int i = 0; i < SceneManager.sceneCount; i++)
{
var roots = SceneManager.GetSceneAt(i).GetRootGameObjects();
foreach (var r in roots)
{
ShowAllInChilds(r);
}
}
}
static void ShowAllInChilds(GameObject go)
{
foreach (var c in go.GetComponentsInChildren<Component>())
{
c.gameObject.hideFlags = HideFlags.None;
c.hideFlags = HideFlags.None;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment