Skip to main content

Function: createUiTooltipEcsSystem()

createUiTooltipEcsSystem(time): EcsSystem<[TooltipEcsComponent, UiInteractableEcsComponent]>

Defined in: ui/systems/ui-tooltip-system.ts:62

Creates a system that shows/hides a TooltipEcsComponent's panel/ label (toggling SpriteEcsComponent.enabled/TextEcsComponent.enabled, the same mechanism createDropdown uses to hide its closed option list) based on the source entity's own UiInteractableEcsComponent state: visible while deriveUiInteractionVisualState reads hover or pressed (pointer-hovered, gamepad/keyboard-focused, or mid-press - source-agnostic, like the rest of this module) and that state has held continuously for at least showDelayMilliseconds; hidden immediately otherwise.

Positioning is deliberately not this system's job - createTooltip parents the tooltip to the source entity with an ordinary anchored RectTransformEcsComponent, so createUiLayoutEcsSystem resolves its position every frame exactly like any other UI child, following the source (and reflecting layout changes to it) with no extra code here.

Must be registered after createUiInteractionEcsSystem and createUiNavigationEcsSystem (it reads the interaction state they write) and before createRenderEcsSystem.

Parameters​

time​

Time

The time instance driving hoverElapsedMilliseconds.

Returns​

EcsSystem<[TooltipEcsComponent, UiInteractableEcsComponent]>

The UI tooltip ECS system.