Skip to main content

Function: createPanel()

createPanel(world, parent, options): number

Defined in: ui/utilities/create-panel.ts:71

Creates a UI panel: an entity with a RectTransformEcsComponent (parented to parent) and a SpriteEcsComponent. createUiLayoutEcsSystem drives the sprite's width/height/pivot/sortDepth from the resolved rect every frame - the panel always exactly fills its rect.

Parameters​

world​

EcsWorld

The ECS world to create the panel entity in.

parent​

number

The parent entity - a canvas (see createUiCanvas) or another UI element.

options​

CreatePanelOptions

Options for configuring the panel. sprite has no sensible default and must always be provided.

Returns​

number

The created panel entity.