works fine in my case, i can see my context menu on both Main Menu on Unity editor and on Hierarchy
here are some examples i’ve done.
i tried Menutem and the ContextMenu attributes i hope this is the one you are looking for
public class MyTest{
//You can see this under GameObject/UI
//Grouped together with the UI components
[MenuItem("GameObject/UI/Text Area", false, 10)]
public static void CreateTextArea(){
GameObject go = new GameObject("Name");
}
//You can see this under GameObject
[MenuItem("GameObject/My Custom Contex Menu Item 1/Subitem 1", false, 10)]
public static void CreateTextArea2(){
GameObject go = new GameObject("Name");
}
[MenuItem("GameObject/My Custom Contex Menu Item 1/Subitem 2", false, 10)]
public static void CreateTextArea3(){
GameObject go = new GameObject("Name");
}
[MenuItem("GameObject/My Custom Contex Menu Item 2", false, 10)]
public static void CreateTextArea5(){
GameObject go = new GameObject("Name");
}
}
//Will add a Test->MyItem on the Add Component button on inspector
[AddComponentMenu("Test/MyItem")]
public class MyComponentTest : MonoBehaviour {
//Right clicking on this component in the inspector will show this
[ContextMenu ("Context Menu for my Component")]
void DoSomething () {
Debug.Log ("Perform something");
}
}
Sometimes when you add a custom menu (“CONTEXT”) the editor UI has to update itself.
You can achieve that by reimporting the asset that has the code in it, or just simply restarting Unity.
This happens when you uninstall assets, how the menu items and info will still remain. GameObject is already a menu item on unity, so it’s easy to tie in.
Using “CONTEXT/ObjectType/MenuName” will cause it to appear in rightclick menu within inspector (meaning, it’ll show up when you right click component title in inspector, which is close to useless).
Also, it is possible to add menus to asset list, via “Assets/MenuName” paths.