Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UIElement

Represents a UI element in the game world. Can be attached to an object using GameObject.addUI or directly added to the world with GameWorld.addUI. If you want to modify values of the UI element, after adding it, for example to modify its location, you need to call GameObject.updateUI (or GameWorld.updateUI) afterwards to apply the update.
You can't modify the widget property as an update, but you can change properties of the widget without needing to call updateUI.
If you have multiple widgets on the same plane, it is usually easier and faster to use one UI element with a Canvas widget instead of one UI element for each widget.

Hierarchy

  • UIElement

Index

Properties

anchorX

anchorX: number

The horizontal anchor point of the UI. Determines where position is in relation to the UI: for 0 it is at the left side, 0.5 is at the center, 1.0 is the right side. Default: 0.5

anchorY

anchorY: number

The vertical anchor point of the UI. Determines where position is in relation to the UI: for 0 it is at the top, 0.5 is at the center, 1.0 is the bottom. Default: 0.5

height

height: number

Height in pixels to use for rendering the UI. Only used when useWidgetSize is false. Default: 90

position

position: Vector

The center position of the component. Relative to the object center when attached to an object.

rotation

rotation: Rotator

The rotation for this component. Relative to the object rotation when attached to an object. On the default zero rotation, the UI is facing upwards.

scale

scale: number

The scale of this component. At scale 1, one pixel of width or height corresponds to one millimeter. Relative to the object scale when attached to an object. Default: 1

twoSided

twoSided: boolean

If true, show the UI from both the front and the back. It will be mirrored when seen from the back! If false, the UI is invisible from the back. Default: false

useTransparency

useTransparency: boolean

If true, use the alpha channel of widget colors to allow for partly transparent UIs. If false, use alpha as a mask instead: low alpha values are invisible, high alpha values are completely opaque. Default: false

useWidgetSize

useWidgetSize: boolean

If true, use the natural size of the UI instead of the specified width and height. Default: true

widget

widget: Widget

The main widget of this component

width

width: number

Width in pixels to use for rendering the UI. Only used when useWidgetSize is false. Default: 160

Methods

clone