Version 3.3.1.2

GenericMenuExtensions class

Namespace: Sirenix.Utilities.Editor
Assembly: Sirenix.Utilities.Editor
public static class GenericMenuExtensions
Collection of extension methods for UnityEditor.GenericMenu.
Inheritance
  • System.Object
  • GenericMenuExtensions

Methods

RemoveMenuItems(GenericMenu, String)
Removes all menu items with a given name from the GenericMenu.
public static bool RemoveMenuItems(this GenericMenu menu, string name)
Parameters
UnityEditor.GenericMenu menu

The GenericMenu to remove items from.

System.String name

The name of the items to remove.

Returns
System.Boolean

True if any items were removed, otherwise false.

ReplaceOrAdd(GenericMenu, String, Boolean, GenericMenu.MenuFunction)
Replaces the first found menu item with a given name with a new menu item, or if no such element is found, adds a new one.
public static bool ReplaceOrAdd(this GenericMenu menu, string name, bool on, GenericMenu.MenuFunction func)
Parameters
UnityEditor.GenericMenu menu

The GenericMenu to replace items in.

System.String name

The name of the items to remove.

System.Boolean on

The on value to set the new menu item with.

UnityEditor.GenericMenu.MenuFunction func

The func to replace or add.

Returns
System.Boolean

True if an item was replaced, otherwise false.

ReplaceOrAdd(GenericMenu, String, Boolean, GenericMenu.MenuFunction2, Object)
Replaces the first found menu item with a given name with a new menu item, or if no such element is found, adds a new one.
public static bool ReplaceOrAdd(this GenericMenu menu, string name, bool on, GenericMenu.MenuFunction2 func2, object userData)
Parameters
UnityEditor.GenericMenu menu

The GenericMenu to replace items in.

System.String name

The name of the items to remove.

System.Boolean on

The on value to set the new menu item with.

UnityEditor.GenericMenu.MenuFunction2 func2

The func to replace or add.

System.Object userData

The user data.

Returns
System.Boolean

True if an item was replaced, otherwise false.