tutastealth.blogg.se

Unity asset editor
Unity asset editor










Each item in Unity’s menus has an unknown sort priority, so finding where to place your item can be annoying.

unity asset editor

Sorting menu items can be a bit of guesswork.

  • Priority - Set this value to specify the order in which your item will appear in each menu.
  • This is a very useful feature, but a bit out of scope of this post, so to find out more about validating menu items, read Unity’s blog post.
  • isValidateFunction - When set to true, this causes your method to be called before a corresponding method (another method tagged with MenuItem and the same path) can run.
  • MenuItem(string path, bool isValidateFunction, int priority).
  • There is another implementation of the MenuItem attribute that adds the ability to link validation methods, as well as to specify the sort order for your menu item. private static void CreateRedBlueGameObject () Advanced Menu Item Usage This sample code creates a menu item in the GameObject menu which, when selected, creates a new GameObject in the scene named “RedBlue GameObject”.
  • You can specify as many submenus as you want.
  • unity asset editor

    You can optionally assign a hotkey by specifying a keycode after a space in the item name (see Unity’s scripting API for hotkey keycodes).Spaces are allowed in all menu names as well as the item name.You must specify a root menu and an Item Name.

    unity asset editor

    If root is an existing Menu name (“Assets”, “Window”, etc) your item will be added to that menu (except for Component - more on that later).Some additional notes on the Path parameter: The format of the path parameter is as follows: “Root Menu/Sub Menu1/Sub Menu2/Item Name ”.Įxample usage for MenuItem attribute: Path - String that specifies the menu and name for your menu item.See Unity’s documentation on special folder names if you are unfamiliar with that. MenuItem attribute is in the UnityEditor namespace, so you need to include that namespace and place your script in a folder named Editor. To assign a method to a custom menu item you simply add the attribute to a static method (if you are unfamiliar with attributes, see the MSDN documentation.) The method’s accessibility (public / private), return type, and name do not matter.












    Unity asset editor