API

Scene Manager

The Babylon Toolkit Scene Manager provides runtime lifecycle management for game objects. Its script component API supports Unity-style component development for Babylon.js scenes.

Babylon Scene Manager

The Scene Manager is part of the maintained Babylon Toolkit runtime. Use the current TypeScript definitions and ScriptComponent API reference for its public API.

Initialize the Scene Manager before using toolkit components:

await TOOLKIT.SceneManager.InitializeRuntime(engine);

Babylon Scene Components

Create components by extending TOOLKIT.ScriptComponent. The constructor receives the attached transform node, scene, optional exported properties, and a class alias. Override only the lifecycle methods the component needs:

import type { TransformNode } from "@babylonjs/core/Meshes/transformNode";
import type { Scene } from "@babylonjs/core/scene";
namespace PROJECT {
export class SampleScript extends TOOLKIT.ScriptComponent {
constructor(transform: TransformNode, scene: Scene, properties: any = {}, alias: string = "PROJECT.SampleScript") {
super(transform, scene, properties, alias);
}
protected awake(): void {
// Initialize the component.
}
protected start(): void {
// Initialize state that depends on other components.
}
protected update(): void {
// Run frame-by-frame logic.
}
protected destroy(): void {
// Release resources.
}
}
}

The current runtime also provides ready, late, step, fixed, after, and reset lifecycle methods. See the maintained Babylon Toolkit examples for namespace and ES module patterns.