UI rendered within the 3D space of a world's game scene.
Signature:
export default class SceneUI extends EventRouter implements protocol.Serializable Extends: EventRouter
Implements: protocol.Serializable
SceneUI instances are created directly as instances. They support a variety of configuration options through the SceneUIOptions constructor argument.
This class is an EventRouter, and instances of it emit events with payloads listed under SceneUIEventPayloads
const sceneUI = new SceneUI({
templateId: 'player-health-bar',
attachedToEntity: playerEntity,
offset: { x: 0, y: 1, z: 0 },
});|
Constructor |
Modifiers |
Description |
|---|---|---|
|
Constructs a new instance of the |
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
|
Entity | undefined |
The entity to which the SceneUI is attached if explicitly set. | |
|
|
number | undefined |
The unique identifier for the SceneUI. | |
|
|
boolean |
Whether the SceneUI is loaded into the world. | |
|
|
Vector3Like | undefined |
The offset of the SceneUI from the attached entity or position. | |
|
|
Vector3Like | undefined |
The position of the SceneUI in the world if explicitly set. | |
|
|
Readonly<object> |
The state of the SceneUI. | |
|
|
string |
The template ID of the SceneUI. | |
|
|
number | undefined |
The maximum view distance the SceneUI will be visible to the player. | |
|
|
World | undefined |
The world the SceneUI is loaded into. |
|
Method |
Modifiers |
Description |
|---|---|---|
|
Loads the SceneUI into the world. | ||
|
Sets the entity to which the SceneUI is attached, following its position. | ||
|
Sets the spatial offset of the SceneUI relative to the attached entity or position. | ||
|
Sets the position of the SceneUI. Will detach from entity if attached. | ||
|
Sets the state of the SceneUI by performing a shallow merge with existing state. | ||
|
Sets the view distance of the SceneUI. | ||
|
Unloads the SceneUI from the world. |