static void AnalyzeGoWithChildren(GameObject go, int nestingLevel, bool topParentHasChild, int nestingGroup, bool isLastChild) { int instanceID = go.GetInstanceID(); if (!sceneGameObjects.ContainsKey(instanceID)) // processes the gameobject only if it wasn't processed already { InstanceInfo newInfo = new InstanceInfo(); newInfo.components = new List <Component>(); newInfo.isLastElement = isLastChild; newInfo.nestingLevel = nestingLevel; newInfo.nestingGroup = nestingGroup; newInfo.hasChilds = go.transform.childCount > 0; newInfo.isGoActive = go.activeInHierarchy; newInfo.topParentHasChild = topParentHasChild; newInfo.goName = go.name; // We minus 1 when inside prefab isolation mode only when // in the first level of Prefab Isolation Mode. if (!IsMainStage() && currentPrefab && currentPrefab.transform.parent == null) { --newInfo.nestingLevel; } tags.Add(go.tag); layers.Add(LayerMask.LayerToName(go.layer)); instanceIDs.Add(instanceID); /* Prefab Data */ { var prefab = PrefabUtility.GetCorrespondingObjectFromSource(go); if (prefab) { newInfo.prefabInstanceID = prefab.GetInstanceID(); EXISTS_PREFAB_ICON = true; } } if (data.separator.GetEnabled()) { newInfo.isSeparator = String.Compare(go.tag, "EditorOnly", StringComparison.Ordinal) == 0 && // gameobject has EditorOnly tag (!string.IsNullOrEmpty(go.name) && !string.IsNullOrEmpty(data.separator.prefix) && go.name.StartsWith(data.separator.prefix)); // and also starts with '>' } if (data.icons.GetEnabled() || data.components.GetEnabled()) { #region Components Information (icons) var comps = go.GetComponents <Component>(); foreach (var c in comps) { if (c == null) { newInfo.components.Add(null); // missing continue; } newInfo.components.Add(c); } #endregion } //Adds element to the array sceneGameObjects.Add(instanceID, newInfo); } #region Analyzes Childrens int childCount = go.transform.childCount; GameObject[] childrens = HierarchyUtil.GetAllChilds(go); if (ALPHA_SORTED) { childrens = childrens.OrderBy(tmpGo => go.name).ToArray(); } for (int j = 0; j < childCount; ++j) { var child = childrens[j]; AnalyzeGoWithChildren( child, nestingLevel + 1, topParentHasChild, nestingGroup, j == childCount - 1); } #endregion }