Skip to main content

Function: addUiToggleComponent()

addUiToggleComponent(world, entity, options?): UiToggleEcsComponent

Defined in: ui/components/ui-toggle-component.ts:57

Attaches a UiToggleEcsComponent to entity. Needs a UiInteractableEcsComponent on the same entity for createUiToggleEcsSystem to flip isOn on invocation.

Parameters​

world​

EcsWorld

The ECS world entity belongs to.

entity​

number

The entity to attach the component to.

options?​

Partial<UiToggleDefaultedOptions> = {}

Options for configuring the toggle. isOn defaults to false; group is omitted by default (an independent checkbox).

Returns​

UiToggleEcsComponent

The attached component, for further tuning, listening to onValueChanged, or reading/setting isOn directly.