Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Forked from FlaShG/HideFlagsUtility.cs
Created March 7, 2023 12:15
Show Gist options
  • Save unitycoder/29a66fe52fbaa1aecc7d5dc181ccdd60 to your computer and use it in GitHub Desktop.
Save unitycoder/29a66fe52fbaa1aecc7d5dc181ccdd60 to your computer and use it in GitHub Desktop.
Shows all GameObjects in the scene with hideFlags, so you can debug them.
using UnityEngine;
using UnityEditor;
public static class HideFlagsUtility
{
[MenuItem("Help/Hide Flags/Show All Objects")]
private static void ShowAll()
{
var allGameObjects = Object.FindObjectsOfType<GameObject>();
foreach (var go in allGameObjects)
{
switch (go.hideFlags)
{
case HideFlags.HideAndDontSave:
go.hideFlags = HideFlags.DontSave;
break;
case HideFlags.HideInHierarchy:
case HideFlags.HideInInspector:
go.hideFlags = HideFlags.None;
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment