Search Unity

Is it possible to create a validate function for a shortcut of the ShortcutManagement?

Discussion in 'Scripting' started by gillemp, Jun 4, 2021.

  1. gillemp

    gillemp

    Joined:
    Nov 23, 2015
    Posts:
    81
    I want to create a validate function like this:
    Code (CSharp):
    1.         [MenuItem("Assets/Fix Class Name... &#f", true)]
    2.         public static bool CheckIfScriptFile()
    3.         {
    4.             return true; // Example, not actual core
    5.         }
    But I want to use the "ShortcutManagement":
    Code (CSharp):
    1.         [Shortcut("Assets/Fix Class Name", KeyCode.F, ShortcutModifiers.Action, true)]
    2.         public static bool CheckIfScriptFile()
    3.         {
    4.                 return true; // Example again, not actual core
    5.         }
    However, It doesn't work. Is there any way you can create a shortcut for the ShortcutManagement with validate function?