Editor.Assets.ObjectOwner
ClassBase class for entities which has object and component relationship such as Editor.Assets.Scene and Editor.Assets.ObjectPrefab.
Index
Properties
Methods
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
readonlycacheFile:Path
Path to the cached asset file.
Inherited from
fileMeta
readonlyfileMeta:AssetImportMetadata
Import metadata for the asset.
Inherited from
id
readonlyid:Uuid
The unique id of the entity.
Inherited from
meta
readonlymeta:Meta
Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.
Inherited from
name
readonlyname:string
The name of the asset.
Inherited from
rootSceneObjects
readonlyrootSceneObjects:SceneObject[]
A list of scene objects which is a direct child of this entity.
sceneObjects
readonlysceneObjects:SceneObject[]
A list of scene objects which is a child of this entity.
type
readonlytype:string
The entity's type.
Inherited from
Methods
addSceneObject()
addSceneObject(
parent):SceneObject
Adds a scene object to the entity.
Parameters
| Parameter | Type |
|---|---|
parent | SceneObject |
Returns
createSceneObject()
createSceneObject(
name):SceneObject
Creates a scene object to the entity.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
findComponents()
findComponents(
entityType):Component[]
Find components on the entity.
Parameters
| Parameter | Type |
|---|---|
entityType | string |
Returns
getDirectlyReferencedEntities()
getDirectlyReferencedEntities():
Entity[]
A list of entities which this entity has a reference to.
Returns
Entity[]
Inherited from
Asset.getDirectlyReferencedEntities
getMeta()
staticgetMeta():Meta
Returns metadata about this type.
Returns
Overrides
getOwnedEntities()
getOwnedEntities():
Entity[]
A list of entities which has a reference to this entity.
Returns
Entity[]
Inherited from
getRootObjectIndex()
getRootObjectIndex(
object):number
Get the index of object within the list of all the root objects.
Parameters
| Parameter | Type |
|---|---|
object | SceneObject |
Returns
number
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
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
| Parameter | Type |
|---|---|
object | SceneObject |
newParent | SceneObject |
position? | number |
Returns
void