Created
December 10, 2023 02:10
-
-
Save baba-s/bc491b0ec8b00f36eddf6c12d2abc578 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 System; | |
using System.Linq; | |
using UnityEditor; | |
using UnityEditor.ShortcutManagement; | |
using UnityEngine; | |
internal static class Example | |
{ | |
[MenuItem( "Tools/Hoge" )] | |
private static void Hoge() | |
{ | |
const string mainMenu = "Main Menu/"; | |
var result = string.Join | |
( | |
"\n", | |
ShortcutManager.instance | |
.GetAvailableShortcutIds() | |
.Where( x => x.StartsWith( mainMenu, StringComparison.Ordinal ) ) | |
.Select( x => x.Remove( 0, mainMenu.Length ) ) | |
.OrderBy( x => x ) | |
); | |
Debug.Log( result ); | |
EditorGUIUtility.systemCopyBuffer = result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example (Unity 2022.1.23f1)