Disable Menu Item in Unity Editor Extension.

Does anyone know how to disable the menu item (make the item display as gray color) in unity
editor extension?

Use the ‘isValidationFunction’ flag in the compiler attribute.

Make a second function, that returns a boolean, which tells the editor whether to enable or disable the menu item. Then use the MenuItem attribute, with the same name as the function you want to validate, and the second parameter ‘true’.

// JS
@MenuItem ("Menu/Item", true)
static function checkMenu() {
    return true;

// C#
[MenuItem ("Menu/Item", true)]
static bool checkMenu() {
    return true;

Remember, the ‘name’ of the menu item has to be the same as the name of the item you are validating.

To clarify- do not modify your existing menu item function, just add a new one with the correct attribute which will tell Unity how and when to make your other function ‘active’ in the menu bar.