Table of Contents

Class ContextMenuItemView

Namespace
Fallencake.UI
Assembly
Fallencake.UI.dll

Unified view/controller for a context menu item. Provides type-safe access to text, icon, and click subscription for both Unity UI Button and modular Button variants.

public class ContextMenuItemView : MonoBehaviour
Inheritance
object
Object
Component
Behaviour
MonoBehaviour
ContextMenuItemView

Properties

Type

Item type that determines which underlying button component to use.

public ContextItemType Type { get; set; }

Property Value

ContextItemType

Methods

SetIcon(Sprite)

Sets the visible icon sprite.

public void SetIcon(Sprite sprite)

Parameters

sprite Sprite

Sprite to display, may be null to hide.

SetText(string)

Sets the visible label text.

public void SetText(string text)

Parameters

text string

Text to display.

SubscribeOnClick(UnityAction)

Subscribes a click callback to the appropriate button component depending on Type.

public void SubscribeOnClick(UnityAction action)

Parameters

action UnityAction

Callback to invoke on click.