Last active
June 12, 2023 19:58
-
-
Save nrichards/2bc4a51f79d688fa4b82bbfae217c7ed to your computer and use it in GitHub Desktop.
Unity: MonKey Commander: Custom command code-chunk to find Component by name in your Project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// This is the magic, added to SelectionUtilities.cs function SelectOfType, | |
/// replacing the similar code, at the end of the function. | |
EditorUtility.ClearProgressBar(); | |
if (Selection.objects.Length > 0) { | |
SetSelectionActiveVersionIndependent(Selection.objects[0]); | |
var components = ((GameObject)Selection.objects[0]).GetComponents(type); | |
foreach (var c in components) { | |
var niceName = ObjectNames.NicifyVariableName(c.GetType().Name); | |
EditorApplication.delayCall += () => { | |
EditorApplication.delayCall += () => { | |
Highlighter.Highlight("Inspector", niceName); | |
}; | |
}; | |
} | |
} | |
else | |
{ | |
Debug.Log("MonKey found no objects of the corresponding type"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
📺 Video demo: https://youtu.be/RnSxForUd_A 🥳
Flaws: