Skip to main content

Worlds

A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 Tutorial. 📘 API.

Extends​

Implements​

Properties​

enabled​

enabled: boolean = true

Component.enabled

Overrides​

Component . enabled


list​

list: DataMap<string, World>

A collection of worlds managed by this component. The key is the unique identifier (UUID) of the world, and the value is the World instance.


onAfterUpdate​

readonly onAfterUpdate: Event<unknown>

Updateable.onAfterUpdate

Implementation of​

Updateable . onAfterUpdate


onBeforeUpdate​

readonly onBeforeUpdate: Event<unknown>

Updateable.onBeforeUpdate

Implementation of​

Updateable . onBeforeUpdate


onDisposed​

readonly onDisposed: Event<unknown>

Disposable.onDisposed

Implementation of​

Disposable . onDisposed


uuid​

static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a"

A unique identifier for the component. This UUID is used to register the component within the Components system.

Methods​

create()​

create<T, U, S>(): SimpleWorld<T, U, S>

Creates a new instance of a SimpleWorld and adds it to the list of worlds.

Type parameters​

Type parameterValueDescription
T extends BaseSceneBaseSceneThe type of the scene, extending from BaseScene. Defaults to BaseScene.
U extends BaseCameraBaseCameraThe type of the camera, extending from BaseCamera. Defaults to BaseCamera.
S extends BaseRendererBaseRendererThe type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.

Returns​

SimpleWorld<T, U, S>

Throws​

  • Throws an error if a world with the same UUID already exists in the list.

delete()​

delete(world): void

Deletes a world from the list of worlds.

Parameters​

ParameterTypeDescription
worldWorldThe world to be deleted.

Returns​

void

Throws​

  • Throws an error if the provided world is not found in the list.

dispose()​

dispose(): void

Disposes of the Worlds component and all its managed worlds. This method sets the enabled flag to false, disposes of all worlds, clears the list, and triggers the onDisposed event.

Returns​

void

Implementation of​

Disposable . dispose


isConfigurable()​

isConfigurable(): this is Configurable<any, any>

Whether is component is Configurable.

Returns​

this is Configurable<any, any>

Inherited from​

Component . isConfigurable


isDisposeable()​

isDisposeable(): this is Disposable

Whether is component is Disposable.

Returns​

this is Disposable

Inherited from​

Component . isDisposeable


isHideable()​

isHideable(): this is Hideable

Whether is component is Hideable.

Returns​

this is Hideable

Inherited from​

Component . isHideable


isResizeable()​

isResizeable(): this is Resizeable

Whether is component is Resizeable.

Returns​

this is Resizeable

Inherited from​

Component . isResizeable


isSerializable()​

isSerializable(): this is Serializable<any, Record<string, any>>

Whether is component is Serializable.

Returns​

this is Serializable<any, Record<string, any>>

Inherited from​

Component . isSerializable


isUpdateable()​

isUpdateable(): this is Updateable

Whether is component is Updateable.

Returns​

this is Updateable

Inherited from​

Component . isUpdateable


update()​

update(delta?): void | Promise<void>

Updateable.update

Parameters​

ParameterType
delta?number

Returns​

void | Promise<void>

Implementation of​

Updateable . update