Skip to main content

Editor.Assets.ObjectOwner

Class

Base class for entities which has object and component relationship such as Editor.Assets.Scene and Editor.Assets.ObjectPrefab.

Index

Example

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const scene = model.project.scene;
// Scene extends ObjectOwner — use it to demonstrate ObjectOwner's API
const owner: Editor.Assets.ObjectOwner = scene as unknown as Editor.Assets.ObjectOwner;
// Create a new scene object
const newObj = owner.createSceneObject('DemoObject');
console.log(`Created: ${newObj.name}`);
const idx = owner.getRootObjectIndex(newObj);
console.log(`Root index: ${idx}`);

Extends

Extended by

Properties

cacheFile

readonly cacheFile: Path

Path to the cached asset file.

Inherited from

Asset.cacheFile


fileMeta

readonly fileMeta: AssetImportMetadata

Import metadata for the asset.

Inherited from

Asset.fileMeta


id

readonly id: Uuid

The unique id of the entity.

Inherited from

Asset.id


meta

readonly meta: Meta

Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.

Inherited from

Asset.meta


name

readonly name: string

The name of the asset.

Inherited from

Asset.name


rootSceneObjects

readonly rootSceneObjects: SceneObject[]

A list of scene objects which is a direct child of this entity.


sceneObjects

readonly sceneObjects: SceneObject[]

A list of scene objects which is a child of this entity.


type

readonly type: string

The entity's type.

Inherited from

Asset.type

Methods

addSceneObject()

addSceneObject(parent): SceneObject

Adds a scene object to the entity.

Parameters

ParameterType
parentSceneObject

Returns

SceneObject


createSceneObject()

createSceneObject(name): SceneObject

Creates a scene object to the entity.

Parameters

ParameterType
namestring

Returns

SceneObject


findComponents()

findComponents(entityType): Component[]

Find components on the entity.

Parameters

ParameterType
entityTypestring

Returns

Component[]


getDirectlyReferencedEntities()

getDirectlyReferencedEntities(): Entity[]

A list of entities which this entity has a reference to.

Returns

Entity[]

Inherited from

Asset.getDirectlyReferencedEntities


getMeta()

static getMeta(): Meta

Returns metadata about this type.

Returns

Meta

Overrides

Asset.getMeta


getOwnedEntities()

getOwnedEntities(): Entity[]

A list of entities which has a reference to this entity.

Returns

Entity[]

Inherited from

Asset.getOwnedEntities


getRootObjectIndex()

getRootObjectIndex(object): number

Get the index of object within the list of all the root objects.

Parameters

ParameterType
objectSceneObject

Returns

number


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

Asset.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

Asset.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

Asset.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

Asset.isSame


reparentSceneObject()

reparentSceneObject(object, newParent, position?): void

Reparent the scene object to another scene object. You can use this to reparent objects to the root (i.e. pass in null).

Parameters

ParameterType
objectSceneObject
newParentSceneObject
position?number

Returns

void