Skip to main content

Function: resolveCanvasGroupState()

resolveCanvasGroupState(world, entity): CanvasGroupState

Defined in: ui/utilities/resolve-canvas-group-state.ts:45

Walks entity's ParentEcsComponent chain (starting at entity itself) combining every CanvasGroupEcsComponent found along the way: alpha multiplies, interactable/blocksRaycasts AND together. The walk stops after including a group whose ignoreParentGroups is true - that group's own values still apply, but nothing further up the chain does.

Used by createUiCanvasGroupEcsSystem (alpha) and by createUiRaycastEcsSystem/createUiInteractionEcsSystem/ createUiNavigationEcsSystem (interactable/blocksRaycasts) so a group's effect reaches every descendant without mutating each one's own UiInteractableEcsComponent/SpriteEcsComponent/TextEcsComponent fields - only the generic opacityMultiplier fields are ever written, leaving each element's own authored tint/interactable/blocksRaycasts untouched underneath.

Parameters​

world​

EcsWorld

The ECS world entity belongs to.

entity​

number

The entity to resolve the combined canvas group state for.

Returns​

CanvasGroupState

The combined alpha/interactable/blocksRaycasts, { alpha: 1, interactable: true, blocksRaycasts: true } if no CanvasGroupEcsComponent governs entity at all.