Skip to main content

Interface: LayoutElementEcsComponent

Defined in: ui/components/layout-element-component.ts:32

ECS-style component interface overriding a UI element's measured size for createUiLayoutGroupEcsSystem and ContentSizeFitterEcsComponent. Every field but ignoreLayout is optional - omitted, a group falls back to this element's current RectTransformEcsComponent size (x/y) as its preferred size, with a min of 0 and a flexible weight of 0 (fixed size, taking no share of any leftover space in a force-expanded group). Add this component only to override that default on a per-field basis; a plain RectTransformEcsComponent with no LayoutElementEcsComponent at all is still a perfectly valid, fixed-size layout group child.

Extends​

Properties​

flexibleHeight?​

optional flexibleHeight?: number

Defined in: ui/components/layout-element-component.ts:64

This element's share of a force-expanding group's leftover vertical space, relative to its siblings' own flexibleHeight. 0 (the default) takes none.


flexibleWidth?​

optional flexibleWidth?: number

Defined in: ui/components/layout-element-component.ts:57

This element's share of a force-expanding group's leftover horizontal space, relative to its siblings' own flexibleWidth - e.g. 2 takes twice the leftover space of a sibling with 1. 0 (the default) takes none.


ignoreLayout​

ignoreLayout: boolean

Defined in: ui/components/layout-element-component.ts:18

Excludes this entity from its parent's layout group entirely - the group neither measures it (its size doesn't count toward the group's own preferred/min size) nor arranges it (its RectTransformEcsComponent is left untouched). Useful for a decorative child (a background flourish, a badge overlay) placed inside a panel a HorizontalLayoutGroupEcsComponent/ VerticalLayoutGroupEcsComponent/GridLayoutGroupEcsComponent also arranges. Defaults to false.

Inherited from​

LayoutElementDefaultedOptions.ignoreLayout


minHeight?​

optional minHeight?: number

Defined in: ui/components/layout-element-component.ts:37

Overrides the smallest height a group will ever shrink this element to.


minWidth?​

optional minWidth?: number

Defined in: ui/components/layout-element-component.ts:34

Overrides the smallest width a group will ever shrink this element to.


preferredHeight?​

optional preferredHeight?: number

Defined in: ui/components/layout-element-component.ts:49

Overrides this element's natural height, before any group distributes leftover space.


preferredWidth?​

optional preferredWidth?: number

Defined in: ui/components/layout-element-component.ts:43

Overrides this element's natural width, before any group distributes leftover space.


sizeToText?​

optional sizeToText?: boolean

Defined in: ui/components/layout-element-component.ts:79

This element's preferred (and min) size, on whichever axis this is relevant to, comes from its own TextMeshEcsComponent.bounds instead of RectTransformEcsComponent's own size. Requires a TextEcsComponent on the same entity - createUiLayoutGroupEcsSystem throws otherwise. Its TextMeshEcsComponent (added once createTextShapingEcsSystem actually shapes the text) may not exist yet on the very first tick a brand-new entity is created - that tick measures as 0 rather than throwing, self-correcting the next tick once shaping runs. An explicit preferredWidth/preferredHeight still overrides this, the same precedence every other LayoutElementEcsComponent field already has. Defaults to false.