private void FindInGO(Object go, MissingScriptsCounter counter) { var g = go as GameObject; if (g == null) { return; } counter.goCount++; Component[] components = g.GetComponents <Component>(); for (int i = 0; i < components.Length; i++) { counter.componentsCount++; OnDoTask(components[i], i, g, counter); //if (components[i] == null) //{ // var fullName = GetFullName(g); // counter.missingCount++; // Mogo.Util.LoggerHelper.Debug(fullName + " has an empty script attached in position: " + i, g); //} } // Now recurse through each child GO (if there are any): foreach (Transform childT in g.transform) { //Mogo.Util.LoggerHelper.Debug("Searching " + childT.name + " " ); FindInGO(childT.gameObject, counter); } }
void OnDoTask(Component com, int i, GameObject g, MissingScriptsCounter counter) { if (com == null) { var fullName = GetFullName(g); counter.missingCount++; Debug.LogWarning(fullName + " has an empty script attached in position: " + i, g); } }
private void UpdateFindMissing() { if (counter != null) { if (counter.currentIndex < selection.Length) { var g = selection[counter.currentIndex]; FindInGO(g, counter); counter.currentIndex++; info = string.Format("{0}/{1}", counter.currentIndex, selection.Length); } else { OnTaskFinished(); counter = null; } Repaint(); } }
private void FindInGO(Object go, MissingScriptsCounter counter) { var g = go as GameObject; if (g == null) return; counter.goCount++; Component[] components = g.GetComponents<Component>(); for (int i = 0; i < components.Length; i++) { counter.componentsCount++; OnDoTask(components[i], i, g, counter); //if (components[i] == null) //{ // var fullName = GetFullName(g); // counter.missingCount++; // Mogo.Util.LoggerHelper.Debug(fullName + " has an empty script attached in position: " + i, g); //} } // Now recurse through each child GO (if there are any): foreach (Transform childT in g.transform) { //Mogo.Util.LoggerHelper.Debug("Searching " + childT.name + " " ); FindInGO(childT.gameObject, counter); } }
private void FindInSelected() { selection = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets); counter = new MissingScriptsCounter(); }