Skip to main content

Function: addUiInteractableComponent()

addUiInteractableComponent(world, entity, options?): UiInteractableEcsComponent

Defined in: ui/components/ui-interactable-component.ts:159

Attaches a UiInteractableEcsComponent to entity. Needs a RectTransformEcsComponent on the same entity (or a parent chain resolving to one) for createUiRaycastEcsSystem to hit-test against; use createButton for the common "clickable rect with a label" case.

Parameters​

world​

EcsWorld

The ECS world entity belongs to.

entity​

number

The entity to attach the component to.

options?​

Partial<UiInteractableDefaultedOptions> = {}

Options for configuring the interactable.

Returns​

UiInteractableEcsComponent

The attached component, for further tuning, listening to its events, or reading its interaction state.