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

interface ObjectOwner {
    cacheFile: Path;
    fileMeta: AssetImportMetadata;
    id: Uuid;
    name: string;
    rootSceneObjects: SceneObject[];
    sceneObjects: SceneObject[];
    type: string;
    addSceneObject(parent: SceneObject): SceneObject;
    createSceneObject(name: string): SceneObject;
    findComponents(entityType: string): Component[];
    getDirectlyReferencedEntities(): Entity[];
    getOwnedEntities(): Entity[];
    getRootObjectIndex(object: SceneObject): number;
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
    remapReferences(referenceMapping: object): void;
    reparentSceneObject(object: SceneObject, newParent: SceneObject, position?: number): void;
}

Hierarchy (view full)

Properties

cacheFile: Path
id: Uuid

The unique id of the entity.

name: string

The name of the asset.

rootSceneObjects: SceneObject[]

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

sceneObjects: SceneObject[]

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

type: string

The entity's type.

Methods

  • Beta

    Creates a scene object to the entity.

    Parameters

    • name: string

    Returns SceneObject

  • Beta

    Find components on the entity.

    Parameters

    • entityType: string

    Returns Component[]

  • Beta

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

    Parameters

    Returns number

  • Beta

    Parameters

    • type: string

    Returns boolean

  • Beta

    Swap this entity for another one based on a JSON of the current entity id and the target entity id.

    Parameters

    • referenceMapping: object

    Returns void

  • Beta

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

    Parameters

    Returns void