MenuCommand ClassScripting > Editor Classes > MenuCommandUsed to extract the context for a MenuItem. MenuCommand objects are passed to custom menu item functions defined using the MenuItem attribute.
Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.
// Add context menu named "Do Something" to context menu @MenuItem ("CONTEXT/Rigidbody/Do Something") static function DoSomething (MenuCommand command) { var body : Rigidbody = command.context; body.mass = 5; } See Also: MenuItem Variables
Constructors
|