Skip to content

Scenes, nodes and components ​

Scene documents ​

Scenes are persisted as .scene.json: a node tree, component data and Prefab references. At runtime you get a read-only document plus a mutable instance: Prefabs are expanded and overrides applied while instantiating, after which node and component data is the single source of truth.

json
{
  "formatVersion": 1,
  "root": {
    "uid": "n_root",
    "name": "Root",
    "components": [
      { "type": "suity.transform", "properties": { "x": 0, "y": 0 } }
    ]
  }
}

Nodes ​

SceneInstance and the SDK Node expose a consistent set of operations:

OperationAPI
Query by ref / uidscene.get(ref) / scene.getByUid(uid)
Traversescene.getAll(), node.children
Structural edits (require mutable)scene.instantiatePrefab(...), node.addComponent(...), node.removeComponent(...)
Visual containernode.container() (Pixi Container)

Nodes have two data-only switches:

  • active hides the whole subtree while still allowing selection and focus in the editor.
  • bind is the binding name used with [Group/Element] paths (editor and Actor).

Components ​

Component types use the neutral suity.* prefix and are defined by the engine catalog:

TypePurpose
suity.transformPosition / rotation / scale; exactly one per spatial node
suity.spriteTexture sprite
suity.vectorSVG vector (vector Graphics with raster fallback)
suity.textText box
suity.imageExplicit size with a fit mode
suity.buttonFour-state overlay colors and click events
suity.camera2d2D orthographic camera
suity.customPropertiesUser-defined typed values and references
suity.hitArea2dLocal rectangle hit area (physics/picking)
suity.playAudioAudio playback routed through the project mixer

Shared component semantics:

  • enabled is data state: disabled components neither render nor respond to interaction, and Play rebuilds from current data.
  • Visual fields are view-first, structural fields data-first; writing view/native does not write back to data.
  • component.visual() returns the component's own render view (or null); component.native() returns the module controller/renderer (or null).

Prefabs ​

  • A Prefab has strictly one root; the editor wraps multi-root selections in a synthetic main root.
  • Runtime instantiatePrefab requires exactly one root, otherwise it returns PREFAB_INVALID.
  • Instances are data-only: overrides apply once at instantiation, and later node/component edits do not write back to the Prefab.
  • Direct child refs look like instance/child; non-transform components on the source root, Layer/Tag and scene-owned children are preserved.

Assets ​

Assets are managed by the registry and support Addressable Keys, uids and plain URLs. At runtime scene.assets resolves them:

ts
const texture = await scene.assets.loadTexture("textures/hero");
const record = await scene.assets.resolve("audio/hit");

The engine caches textures, SVGs and fonts; the same asset is shared across nodes.

Layers and tags ​

  • Layer is a single value used for render order and logical grouping.
  • Tag is multi-valued and used for physics/query filters (filter.tags, excludeTags).
  • The camera is exposed as scene.mainCamera; getMainCameraView(width, height) returns the letterboxed view rect. Without a usable camera, Play and deployment show NO CAMERA.

Suity developer documentation · API generated by TypeDoc