Skip to main content

Function: createUiToggleEcsSystem()

createUiToggleEcsSystem(): EcsSystem<[UiToggleEcsComponent, UiInteractableEcsComponent]>

Defined in: ui/systems/ui-toggle-system.ts:59

Creates a system that flips a UiToggleEcsComponent.isOn whenever its UiInteractableEcsComponent.wasInvokedThisFrame is true this tick - by a pointer click or a submit action, whichever path raised it (see DL-14). Toggles with no group flip freely, checkbox-style. Toggles sharing a group behave as a radio group: turning one on turns off every other toggle in the same group, and invoking the already-on toggle in a group with allowSwitchOff: false (the default) is a no-op, since a radio group always has exactly one selection.

Must be registered after createUiNavigationEcsSystem and (if present) createUiInteractionEcsSystem, since both write wasInvokedThisFrame for this tick; createUiCanvas does this for you.

Returns​

EcsSystem<[UiToggleEcsComponent, UiInteractableEcsComponent]>

The UI toggle ECS system.