Skip to content

Instantly share code, notes, and snippets.

@Petethegoat
Created March 31, 2024 22:20
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