Created
March 31, 2024 22:20
-
-
Save Petethegoat/e1cb72fdc330f6ecbfacb5f5ebffde1f to your computer and use it in GitHub Desktop.
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
using UnityEngine; | |
using UnityEditor; | |
public static class SelectScript | |
{ | |
[MenuItem("CONTEXT/Component/Select Script File")] | |
static void SelectScriptFile(MenuCommand command) | |
{ | |
Selection.activeObject = AssetDatabase.LoadAssetAtPath<MonoScript>(AssetDatabase.GUIDToAssetPath(AssetDatabase.FindAssets(MonoScript.FromMonoBehaviour(command.context as MonoBehaviour).name)[0])); | |
//Does not handle non monobehaviour/monoscript components. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment