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
-
objectObjectComponentBehaviourMonoBehaviourContextMenuItemView
Properties
Type
Item type that determines which underlying button component to use.
public ContextItemType Type { get; set; }
Property Value
Methods
SetIcon(Sprite)
Sets the visible icon sprite.
public void SetIcon(Sprite sprite)
Parameters
spriteSpriteSprite to display, may be null to hide.
SetText(string)
Sets the visible label text.
public void SetText(string text)
Parameters
textstringText to display.
SubscribeOnClick(UnityAction)
Subscribes a click callback to the appropriate button component depending on Type.
public void SubscribeOnClick(UnityAction action)
Parameters
actionUnityActionCallback to invoke on click.