API/core/Scene/

Scene

Scene.

Hierarchy: EngineObject

constructor 

new Scene(engine: Engine, name: string)

Create scene.

Parameters

  • engine

    Engine

  • optionalname

    Name

features 

features: [] = []

instanceId ReadOnly

instanceId: number = ++EngineObject._instanceIdCounter

Engine unique id.

name 

name: string

scene name

shaderData ReadOnly

shaderData: ShaderData = ...

scene-related shaderdata

sceneFeatureManager 

sceneFeatureManager: FeatureManager = ...

destroyed 

get destroyed(): boolean

Whether it's destroyed.

readonly

engine 

get engine(): Engine

Get the scene's engine.

readonly

rootEntities 

get rootEntities(): readonly <Entity[]>

Root entity collection.

readonly

rootEntitiesCount 

get rootEntitiesCount(): number

Count of root entities.

readonly

addRootEntity 

addRootEntity(entity: Entity): void

Append an entity.

Parameters

  • entity

    The root entity to add

createRootEntity 

createRootEntity(name: string): Entity

Create root entity.

Parameters

  • optionalname

    Entity name

Returns

Entity

destroy 

destroy(): void

Destroy this scene.

findEntityByName 

findEntityByName(name: string): Entity

Find entity globally by name.

Parameters

  • name

    Entity name

Returns

Entity

findEntityByPath 

findEntityByPath(path: string): Entity

Find entity globally by name,use ‘/’ symbol as a path separator.

Parameters

  • path

    Entity's path

Returns

Entity

findFeature 

findFeature<T extends SceneFeature>(Feature: T): T

Parameters

  • Feature

getRootEntity 

getRootEntity(index: number): Entity

Get root entity from index.

Parameters

  • index

    Index

Returns

Entity

raycast 

raycast(ray: T, outPos: Vector3, tag: Layer): any

Raycast.

deprecated

Parameters

  • ray

  • optionaloutPos

  • optionaltag

removeRootEntity 

removeRootEntity(entity: Entity): void

Remove an entity.

Parameters

  • entity

    The root entity to remove

registerFeature 

registerFeature(Feature: T): void

Parameters

  • Feature