Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ScreenUIElement

Represents a UI element on the screen. Can be added to the screen using GameWorld.addScreenUI. If you want to modify values of the UI element after adding it, for example to modify its location, you need to call GameWorld.updateScreenUI 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 updateScreenUI.
Screen UI elements are not visible for VR players, because there is no screen in VR where they could be attached. Don't use screen UI for elements that are required for playing, or VR players won't be able to play properly! You can also check whether a player is using VR with Player.isUsingVR and add a 3D UI only for VR players using UIElement.players.

Hierarchy

  • ScreenUIElement

Index

Properties

anchorX

anchorX: number

The horizontal anchor point of the UI. Determines where positionX 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

anchorY

anchorY: number

The vertical anchor point of the UI. Determines where positionY 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

height

height: number

Height to use for rendering the UI. Can be in pixels or relative to the screen size. Default: 90

players

Determine which players see the UI. By default, it will be shown for all players (except for VR players).

positionX

positionX: number

The X position of the UI element on the screen. Can be in pixels or relative to the screen size.

positionY

positionY: number

The X position of the UI element on the screen. Can be in pixels or relative to the screen size.

relativeHeight

relativeHeight: boolean

If true, height is relative to the screen (or window) size instead of in pixels, where the whole screen is 1.0 units high. Default: false

relativePositionX

relativePositionX: boolean

If true, positionX is relative to the screen (or window) size instead of in pixels, where the whole screen is 1.0 units wide. Default: true

relativePositionY

relativePositionY: boolean

If true, positionY is relative to the screen (or window) size instead of in pixels, where the whole screen is 1.0 units high. Default: true

relativeWidth

relativeWidth: boolean

If true, width is relative to the screen (or window) size instead of in pixels, where the whole screen is 1.0 units wide. Default: false

widget

widget: Widget

The main widget of this component

width

width: number

Width to use for rendering the UI. Can be in pixels or relative to the screen size. Default: 160

Methods

clone