docs.unity3d.com
    Show / Hide Table of Contents

    Class MenuAction

    Base class from which any action that is represented in the ProBuilder toolbar inherits.

    Inheritance
    Object
    MenuAction
    MakeFacesDoubleSided
    SoftDeleteEdgesAction
    MenuToolToggle
    Namespace: UnityEditor.ProBuilder
    Syntax
    public abstract class MenuAction

    Constructors

    MenuAction()

    Declaration
    protected MenuAction()

    Fields

    onPerformAction

    Declaration
    public static Action<MenuAction> onPerformAction
    Field Value
    Type Description
    Action<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
    hidden

    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
    enabled

    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. 0 is first, 1 is second, -1 is no preference.

    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()

    Declaration
    [Obsolete("DoAction() has been replaced by PerformAction(), the implementation of the action should inherits from PerformActionImplementation(). (UnityUpgradable) -> PerformAction()", false)]
    public ActionResult DoAction()
    Returns
    Type Description
    ActionResult

    DoAltButton(GUILayoutOption[])

    Declaration
    protected bool DoAltButton(params GUILayoutOption[] options)
    Parameters
    Type Name Description
    GUILayoutOption[] options
    Returns
    Type Description
    Boolean

    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()

    PerformAction()

    Perform whatever action this menu item is supposed to do. Implementation should be coded in PerformActionImplementation. Perform action should be called to trigger the onPerformAction event.

    Declaration
    public ActionResult PerformAction()
    Returns
    Type Description
    ActionResult

    A new ActionResult with a summary of the state of the action's success.

    PerformActionImplementation()

    Perform whatever action this menu item is supposed to do. This method should never been call directly but though PerformAction.

    Declaration
    protected abstract ActionResult PerformActionImplementation()
    Returns
    Type Description
    ActionResult

    A new ActionResult with a summary of the state of the action's success.

    Back to top
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)