Skip to main content

Function: addRectTransformComponent()

addRectTransformComponent(world, entity, options?): RectTransformDefaultedOptions

Defined in: ui/components/rect-transform-component.ts:66

Attaches a RectTransformEcsComponent to entity. Every UI element - including a CanvasEcsComponent's own root entity - has one; createUiLayoutEcsSystem resolves it against its parent's rect (or, for a canvas root, the canvas's reference resolution) every frame.

Parameters​

world​

EcsWorld

The ECS world entity belongs to.

entity​

number

The entity to attach the component to.

options?​

Partial<RectTransformDefaultedOptions> = {}

Options for configuring the rect transform. See UiAnchor for common x/y presets.

Returns​

RectTransformDefaultedOptions

The attached component, for further tuning or runtime changes.