API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classPrefab

@codexo/exojs / core / stable

A reusable, data-driven template captured from a configured scene-graph subtree. Capture once with Prefab.from; stamp out independent copies with instantiate as many times as needed — no re-serialization per instance. A prefab holds the same **data, not behaviour** a scene serializer captures (structure, transforms, visuals, asset references). Re-attach behaviour (signal handlers, systems) in code after instantiate. ```ts const coin = Prefab.from(buildCoin(), loader); for (let i = 0; i < 10; i++) { const node = coin.instantiate(loader); node.setPosition(i * 32, 0); scene.addChild(node); } ```

0
props
4
methods
0
events
Import
import { Prefab } from '@codexo/exojs'

A reusable, data-driven template captured from a configured scene-graph subtree. Capture once with Prefab.from; stamp out independent copies with instantiate as many times as needed — no re-serialization per instance.

A prefab holds the same **data, not behaviour** a scene serializer captures (structure, transforms, visuals, asset references). Re-attach behaviour (signal handlers, systems) in code after instantiate.

```ts const coin = Prefab.from(buildCoin(), loader); for (let i = 0; i \< 10; i++) { const node = coin.instantiate(loader); node.setPosition(i * 32, 0); scene.addChild(node); } ```

Methods 4
instantiate(loader: Loader | null, registry?: SerializationRegistry): SceneNode
toJSON(): SerializedNode
from(node: SceneNode, loader: Loader | null, registry?: SerializationRegistry): Prefab
fromJSON(descriptor: SerializedNode): Prefab
Source