Class MenuAction
Base class from which any action that is represented in the ProBuilder toolbar inherits.
Namespace: UnityEditor.ProBuilder
Syntax
public abstract class MenuAction
Constructors
MenuAction()
Declaration
protected MenuAction()
Properties
disabledIcon
By default this function will look for an image named ${icon}_disabled. If your disabled icon is somewhere else override this function.
Declaration
protected virtual Texture2D disabledIcon { get; }
Property Value
| Type | Description |
|---|---|
| Texture2D |
enabled
A check for whether or not the action is valid given the current selection.
Declaration
public virtual bool enabled { get; }
Property Value
| Type | Description |
|---|---|
| Boolean | True if this action is valid with current selection and mode. |
See Also
group
Declaration
public abstract ToolbarGroup group { get; }
Property Value
| Type | Description |
|---|---|
| ToolbarGroup | What category this action belongs in. |
hasFileMenuEntry
Declaration
protected virtual bool hasFileMenuEntry { get; }
Property Value
| Type | Description |
|---|---|
| Boolean | True if this class should have an entry built into the hardware menu. This is not implemented for custom actions. |
hidden
Is this action visible in the ProBuilder toolbar?
Declaration
public virtual bool hidden { get; }
Property Value
| Type | Description |
|---|---|
| Boolean | True if this action should be shown in the toolbar with the current mode and settings, false otherwise. |
Remarks
This returns false by default.
See Also
icon
Declaration
public abstract Texture2D icon { get; }
Property Value
| Type | Description |
|---|---|
| Texture2D | The icon to be displayed for this action. |
Remarks
Not used when toolbar is in text mode.
iconMode
Declaration
protected bool iconMode { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
menuActionState
Is the current mode and selection valid for this action?
Declaration
public MenuAction.MenuActionState menuActionState { get; }
Property Value
| Type | Description |
|---|---|
| MenuAction.MenuActionState | A flag indicating both the visibility and enabled state for an action. |
menuTitle
Declaration
public virtual string menuTitle { get; }
Property Value
| Type | Description |
|---|---|
| String | Optional override for the action title displayed in the toolbar button. |
Remarks
If unimplemented the tooltip title is used.
optionsMenuState
Get a flag indicating the visibility and enabled state of an extra options menu modifier for this action.
Declaration
protected virtual MenuAction.MenuActionState optionsMenuState { get; }
Property Value
| Type | Description |
|---|---|
| MenuAction.MenuActionState | A flag specifying whether an options icon should be displayed for this action button. If your action implements some etra options, you must also implement OnSettingsGUI. |
toolbarPriority
Declaration
public virtual int toolbarPriority { get; }
Property Value
| Type | Description |
|---|---|
| Int32 | Optional value influences where in the toolbar this menu item will be placed.
|
tooltip
Declaration
public abstract TooltipContent tooltip { get; }
Property Value
| Type | Description |
|---|---|
| TooltipContent | The contents to display for this menu action's tooltip. |
validSelectModes
In which SelectMode states is this action applicable. Drives the virtual bool hidden { get; } property unless overridden.
Declaration
public virtual SelectMode validSelectModes { get; }
Property Value
| Type | Description |
|---|---|
| SelectMode |
Methods
DoAction()
Perform whatever action this menu item is supposed to do. You are resposible for implementing Undo.
Declaration
public abstract ActionResult DoAction()
Returns
| Type | Description |
|---|---|
| ActionResult | A new ActionResult with a summary of the state of the action's success. |
DoAlternateAction()
Declaration
protected virtual void DoAlternateAction()
OnSettingsDisable()
Called when the settings window is closed.
Declaration
protected virtual void OnSettingsDisable()
OnSettingsEnable()
Called when the settings window is opened.
Declaration
protected virtual void OnSettingsEnable()
OnSettingsGUI()
Implement the extra settings GUI for your action in this method.
Declaration
protected virtual void OnSettingsGUI()