Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

starting from scratch #22

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions DarkFlow/Assets/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions DarkFlow/Assets/Editor/FindMissingScripts.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;

public class FindMissingScripts : EditorWindow
{
[MenuItem("Window/Find Missing Scripts")]
public static void ShowWindow()
{
EditorWindow.GetWindow(typeof(FindMissingScripts));
}

public void OnGUI()
{
if (GUILayout.Button("Find Missing Scripts in Selected GameObjects"))
{
FindInSelected();
}
}

private static void FindInSelected()
{
GameObject[] go = Selection.gameObjects;
List<GameObject> objectsWithMissingScripts = new List<GameObject>();
foreach (GameObject g in go)
{
Component[] components = g.GetComponents<Component>();
foreach (Component c in components)
{
if (c == null)
{
objectsWithMissingScripts.Add(g);
Debug.Log("Missing script found in: " + FullPath(g), g);
}
}
}

if (objectsWithMissingScripts.Count > 0)
{
Debug.Log("Found " + objectsWithMissingScripts.Count + " GameObjects with missing scripts.", objectsWithMissingScripts[0]);
}
else
{
Debug.Log("No GameObjects with missing scripts found in selection.");
}
}

private static string FullPath(GameObject go)
{
return go.transform.parent == null
? go.name
: FullPath(go.transform.parent.gameObject) + "/" + go.name;
}
}
11 changes: 11 additions & 0 deletions DarkFlow/Assets/Editor/FindMissingScripts.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions DarkFlow/Assets/Input.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading