[MenuItem (" Tool/Selector ", true)]
The static bool MenuEnable ()
{
The Debug Log (Selection) activeGameObject) name);
Return Selection. ActiveGameObject. Name=="Canvas";
}
The triggering time of the incident, is very confused, look at the log, is closed in the menu of the output, but the actual effect, point to open the menu drop-down box, is also a response to the,
My side of the test scenarios and the results are: the scene inside the Canvas, and other objects, when I selected the other objects (object is called "A", point to open the menu, found that the Selector button is unavailable, but this time without the above log shows that at the moment I click other menu, there will be the emergence of the log (" A "), so I think the response events trigger is in close the menu, but the odd thing was, when I choose the Canvas object open the menu, at this time the returns true, the Selector button is available, click other menu at this time, the Selector button in the menu to shut down, the log (" Canvas "), when the object is still A Canvas I choose, so can be understood as the Selector button is still available at this time, then I chose the other objects, open the menu again, found that the Selector button is not available, but there is no any log output, the process state changed, however, whether can be understood as A response to an event triggered when open the menu, but without the log output, so is very confused, the actual performance log does not match with the code, want to know A thing or two,
CodePudding user response:
MenuItem (string itemName, bool isValidateFunction, int priority)ItemName: the name of the menu path
IsValidateFunction: don't write to false, true, click on the menu is invoked before
Priority: menu item shows sorting
CodePudding user response:
MenuItem (string itemName, bool isValidateFunction, int priority)
ItemName: the name of the menu path
IsValidateFunction: don't write to false, true, click on the menu is invoked before, if this function returns false, the menu item will be disabled,
Priority: menu item shows sorting
CodePudding user response: