unity-编辑器快捷按键

  • 效果图

  • 代码

    [MenuItem("Custom/Run _F1")]
    static void PlayToggle()
    {
        EditorApplication.isPlaying = !EditorApplication.isPlaying;
    } 

    static MethodInfo clearMethod = null;
    [MenuItem("Custom/Clear Console %#z")]
    private static void ClearConsole()
    {
        if (clearMethod == null)
        {
            Type log = typeof(EditorWindow).Assembly.GetType("UnityEditor.LogEntries");
            clearMethod = log.GetMethod("Clear");
        }
        clearMethod.Invoke(null, null);
    }
原文地址:https://www.cnblogs.com/Jaysonhome/p/13288162.html