UnityEditor.GenericMenu.AddDisabledItem C# (CSharp) Method

AddDisabledItem() public method

public AddDisabledItem ( GUIContent content ) : void
content UnityEngine.GUIContent
return void
        public void AddDisabledItem(GUIContent content)
        {
            this.menuItems.Add(new MenuItem(content, false, false, null));
        }

Usage Example

Example #1
0
 private void ContextMenu(Model instance)
 {
     var menu = new GenericMenu();
     menu.AddItem(new GUIContent("New"), false, New);
     if (instance != null) {
         menu.AddItem(new GUIContent("Edit"), false, ShowEditWindow, instance);
     } else {
         menu.AddDisabledItem(new GUIContent("Edit"));
     }
     menu.AddSeparator("");
     if (instance != null) {
         menu.AddItem(new GUIContent("Copy"), false, Copy, instance);
     } else {
         menu.AddDisabledItem(new GUIContent("Copy"));
     }
     if (CanPaste()) {
         menu.AddItem(new GUIContent("Paste"), false, Paste);
     } else {
         menu.AddDisabledItem(new GUIContent("Paste"));
     }
     if (instance != null) {
         menu.AddItem(new GUIContent("Delete"), false, Delete, instance);
     } else {
         menu.AddDisabledItem(new GUIContent("Delete"));
     }
     menu.ShowAsContext();
 }
All Usage Examples Of UnityEditor.GenericMenu::AddDisabledItem