Created
February 9, 2021 15:55
-
-
Save hybridherbst/adcd101ca367365dfbf2d576d6a41e6a to your computer and use it in GitHub Desktop.
Show all objects - disable HideFlags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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