-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsnippets.cs
38 lines (34 loc) · 1.5 KB
/
snippets.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
List<GameObject> goList = new List<GameObject>();
private void PrintObjectNames(Transform t, List<GameObject> list, int depth = 0)
{
list.Add(t.gameObject);
StringBuilder sb = new StringBuilder();
for (var i = 0; i < depth; i++)
sb.Append("\t");
sb.Append(string.Format("{0} - {1}", t.name, (t.gameObject.activeInHierarchy && t.gameObject.activeSelf)));
if ((t.gameObject.activeInHierarchy && t.gameObject.activeSelf) || depth == 0)
Debug.Log(sb.ToString());
for (var i = 0; i < t.childCount; i++)
PrintObjectNames(t.GetChild(i), list, depth + 1);
}
//Get ALL objects
GameObject[] allObjects = Resources.FindObjectsOfTypeAll<GameObject>();
Debug.Log("GameObject Name - Active");
foreach (var go in allObjects)
{
if (goList.Contains(go))
continue;
GameObject GO = go;
while (GO.transform.parent != null)
GO = GO.transform.parent.gameObject;
try
{
//CommonReflectedTypeInfo.DebugLog("GameObject: {0}, ActiveInHierarchy: {1}, ActiveSelf: {2}", go.name, go.activeInHierarchy, go.activeSelf);
PrintObjectNames(GO.transform, goList);
}
catch
{
CommonReflectedTypeInfo.DebugLog("Could Not list this object");
}
}
Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, transform);