Skip to main content

Element

In a hierarchy with a screen component ancestor, the element component is used to build user interfaces composed of 2D components such as images and text. Elements provide layout properties such as anchors and pivot points.

For more details, see the User Interface section.

Group Element

Group elements only provide the layout properties of the element component.

Group Element

Image Element

Image elements display images using texture assets or solid colors.

Image Element

Text Element

Text elements render text strings using font assets.

Text Element

Common Component Properties

PropertyDescription
TypeThe type of element: Group, Image, or Text.
PresetWhen a layout preset is selected, the Anchor and Pivot properties are automatically set to the preset values.
AnchorDetermines the reference point for calculating the element's position. See the Elements#Anchor section for more details.
PivotDetermines where the element's pivot point is located. (0, 0) is bottom-left, (1, 1) is top-right. See the Elements#Pivot section for more details.
SizeThe width and height of the element. Can be automatically calculated based on other settings.
MarginThe distance from the element's edge to the Anchor. Only available when the Anchor is split (not the same on one axis).
Use InputWhen enabled, this element is added to the list of elements that check for input and fire input-related events.
LayersThe layers on which this element will be rendered. See here for more details about layers.
Batch GroupThe batch group this model belongs to.

Image Component Properties

PropertyDescription
RectDefines the area of the texture asset to display.
MaskConverts the image element to a mask. Masks are not rendered to the scene, but instead limit child elements to only render where this element would be rendered.
TextureThe texture asset to display.
ColorThe color to tint the element.
OpacityThe transparency of the element.

Text Component Properties

PropertyDescription
AlignmentDetermines how text is aligned within the element. (0, 0) is bottom-left, (1, 1) is top-right.
TextThe text string to display.
Font SizeThe size in screen component pixels to render the font.
Line HeightThe size in screen component pixels for moving to a new line.
SpacingA multiplier applied to the advance between each character.
FontThe font asset.
ColorThe color to tint the font.
OpacityThe transparency of the element.
Wrap LinesEnables text wrapping. All text that exceeds the width of the text element will wrap to the next line.