Skip to main content

Function: findOwningCanvas()

findOwningCanvas(world, entity): number | null

Defined in: ui/utilities/find-owning-canvas.ts:16

Walks entity's ParentEcsComponent chain (starting at entity itself) to find the CanvasEcsComponent entity it's ultimately parented to - the canvas whose camera/culling mask/inputs govern it. Used by createUiRaycastEcsSystem and createUiInteractionEcsSystem to group interactables by canvas.

Parameters​

world​

EcsWorld

The ECS world entity belongs to.

entity​

number

The entity to find the owning canvas of.

Returns​

number | null

The owning canvas entity id, or null if entity isn't (transitively) parented to one.