Skip to main content

resolve

Retrieves an object by its ID and returns a reference to the corresponding object manager.

This method is used to retrieve an object that has already been created, but for which you don't have a reference to the ObjectManager instance. This can be useful, for example, when the object was created by another script.

Syntax

engine.objects.resolveObject(object);

Parameters

NameTypeDescription
idstringThe ID of the object to retrieve
forceUpdate?booleanWhether or not to force the object to update its data (optional)

Returns

  • Promise<ObjectManager> - A promise that resolves to the reference to the ObjectManager instance for the specified object, or null if the object is not found.

Example

script1.js
const box = engine.objects.create('box', {
id: 'my-box'
})

...
script2.js
const box = await engine.objects.resolve('my-box');

...

Available on: Client