Skip to main content

Editor.Assets.Scene

Class

The entity which will be converted into the Lens scene during project export.

The entity which will be converted into the Lens scene during project export. This scene will contain and own all objects and components in the Lens. This entity can be accessed via the current project’s model.project.scene.

Index

Example

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const scene = model.project.scene;

// Scene exposes: mainCamera, rootSceneObjects, captureTarget, liveTarget
const mainCamera = scene.mainCamera;
const captureTarget = scene.captureTarget;
const liveTarget = scene.liveTarget;

// Create a new scene object at the scene root
const obj = scene.createSceneObject('MyObject');

console.log(`Created "${obj.name}"; scene has ${scene.rootSceneObjects.length} root(s), mainCamera=${Editor.isNull(mainCamera) ? 'none' : mainCamera.name}, targets=[${captureTarget.name}, ${liveTarget.name}]`);

Extends

Properties

cacheFile

readonly cacheFile: Path

Path to the cached asset file.

Inherited from

ObjectOwner.cacheFile


captureTarget

captureTarget: RenderTarget

Render target for capture output.


fileMeta

readonly fileMeta: AssetImportMetadata

Import metadata for the asset.

Inherited from

ObjectOwner.fileMeta


id

readonly id: Uuid

The unique id of the entity.

Inherited from

ObjectOwner.id


layers

readonly layers: Layers

This list of layers that exists within this scene.


liveOverlayTarget

liveOverlayTarget: RenderTarget

Render target for live overlay rendering.


liveTarget

liveTarget: RenderTarget

Render target for live preview output.


mainCamera

readonly mainCamera: Camera

The camera that renders renderOutput.


meta

readonly meta: Meta

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

Inherited from

ObjectOwner.meta


name

readonly name: string

The name of the asset.

Inherited from

ObjectOwner.name


physicsRootWorldSettings

physicsRootWorldSettings: WorldSettingsBase

Physics world settings asset used by the scene's root physics world, or null if none is assigned.


rootSceneObjects

readonly rootSceneObjects: SceneObject[]

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

Inherited from

ObjectOwner.rootSceneObjects


sceneObjects

readonly sceneObjects: SceneObject[]

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

Inherited from

ObjectOwner.sceneObjects


type

readonly type: string

The entity's type.

Inherited from

ObjectOwner.type

Methods

addSceneObject()

addSceneObject(parent): SceneObject

Adds a scene object to the entity.

Parameters

ParameterType
parentSceneObject

Returns

SceneObject

Inherited from

ObjectOwner.addSceneObject


createSceneObject()

createSceneObject(name): SceneObject

Creates a scene object to the entity.

Parameters

ParameterType
namestring

Returns

SceneObject

Inherited from

ObjectOwner.createSceneObject


findComponents()

findComponents(entityType): Component[]

Find components on the entity.

Parameters

ParameterType
entityTypestring

Returns

Component[]

Inherited from

ObjectOwner.findComponents


getDirectlyReferencedEntities()

getDirectlyReferencedEntities(): Entity[]

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

Returns

Entity[]

Inherited from

ObjectOwner.getDirectlyReferencedEntities


getMeta()

static getMeta(): Meta

Returns metadata about this type.

Returns

Meta

Overrides

ObjectOwner.getMeta


getOwnedEntities()

getOwnedEntities(): Entity[]

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

Returns

Entity[]

Inherited from

ObjectOwner.getOwnedEntities


getRootObjectIndex()

getRootObjectIndex(object): number

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

Parameters

ParameterType
objectSceneObject

Returns

number

Inherited from

ObjectOwner.getRootObjectIndex


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

ObjectOwner.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ObjectOwner.getTypeName


instantiatePrefab()

instantiatePrefab(prefab, parent): SceneObject

Instantiate a prefab as a child of parent under this entity.

Parameters

ParameterType
prefabObjectPrefab
parentSceneObject

Returns

SceneObject


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ObjectOwner.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

ObjectOwner.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

Inherited from

ObjectOwner.reparentSceneObject