Scene
Find entities by name, ID, tag, layer, or attached component.
Open referenceKriya documentation
Learn the runtime model, author TypeScript gameplay, connect an AI agent through MCP, and ship the same project across platforms.
Quick start
import { Debug, Input, Script, property } from "@engine/runtime";
export default class PlayerController extends Script {
@property({ type: "number", min: 0, step: 10 })
moveSpeed = 250;
start() {
Debug.log(`${this.entity.name} started`);
}
update(delta: number) {
const direction = Input.getAxis("MoveLeft", "MoveRight");
const velocity = this.entity.getVelocity();
this.entity.setVelocity(direction * this.moveSpeed, velocity.y);
void delta;
}
}Use @engine/runtime for public engine APIs. Relative imports between project scripts are supported; editor modules are not.
Scripting lifecycle
onCollisionEnter, Stay, and Exit receive non-trigger contacts. Trigger variants receive overlaps.
this.timer and this.events clean up script-owned timers and listeners automatically on destruction.
Inspector properties
@property() decorator turns script fields into serialized Inspector controls with labels, ranges, steps, and options. @property({ type: "number", label: "Move Speed", min: 0, step: 10 })
moveSpeed = 250;
@property({ type: "boolean", label: "Can Double Jump" })
canDoubleJump = true;
@property({ type: "enum", label: "Movement", options: ["Walk", "Run"] })
movement = "Walk";Supported metadata includes numbers, strings, booleans, vectors, colors, enums, entities, prefabs, and asset references.
Runtime systems
Find entities by name, ID, tag, layer, or attached component.
Open referenceRead named actions, pointer state, touch controls, and gamepads.
Open referenceRaycast, shape cast, and overlap against the Matter.js world.
Open referenceSchedule scaled or unscaled callbacks with automatic script cleanup.
Open referencePublish typed global signals or listen through an entity-local event bus.
Open referenceFind deterministic A* paths across collision-enabled Tilemap layers.
Open referencePersist JSON-serializable progress, settings, checkpoints, and scores.
Open referenceStart, advance, branch, and end authored DialogueBox conversations.
Open referenceimport { LayerMask, Physics2D, Scene, Script } from "@engine/runtime";
export default class EnemySensor extends Script {
start() {
const player = Scene.findByTag("Player");
if (!player) return;
const hit = Physics2D.raycast(
this.transform.position,
{ x: 1, y: 0 },
{ distance: 240, layerMask: LayerMask.from("Player") },
);
if (hit?.entity.id === player.id) this.entity.playAnimation("Attack");
}
}Engine components
Use getComponent(), getComponents(), hasComponent(), addComponent(), and removeComponent(). Transform cannot be removed.
MCP and AI agents
Agents can read before changing, compile TypeScript with diagnostics, update the active project, and invoke Kriya's export pipeline.
kriya://project kriya://scripting-api Generated API reference
106 top-level symbols
Positions and sizes an entity in screen pixels relative to its nearest UICanvas or Anchor ancestor.
"Anchor" src/runtime/index.ts:136 The nine screen-relative anchor points, or "stretch" to fill the parent rect inset by offset.
type AnchorPoint src/shared/types/components.ts:173 AssetData scripting API.
interface AssetData src/shared/types/assets.ts:47 AssetData.animationClipId: string | undefined Links an editor-visible `.anim` asset to ProjectData.animations.
AssetData.animatorControllerId: string | undefined Links an editor-visible controller asset to ProjectData.animatorControllers.
AssetData.compiledSource: string | undefined AssetData.compiledSource runtime value.
AssetData.diagnostics: string[] | undefined AssetData.diagnostics runtime value.
AssetData.folderId: string | null | undefined Virtual Asset Browser folder. Null or omitted places the asset at the project root.
AssetData.height: number | undefined AssetData.height runtime value.
AssetData.id: string AssetData.id runtime value.
AssetData.mimeType: string AssetData.mimeType runtime value.
AssetData.missing: boolean | undefined Editor-only status set when sourcePath cannot be read.
AssetData.name: string AssetData.name runtime value.
AssetData.physicsMaterial: PhysicsMaterial2D | undefined AssetData.physicsMaterial runtime value.
AssetData.scriptProperties: ScriptPropertyMetadata[] | undefined AssetData.scriptProperties runtime value.
AssetData.size: number AssetData.size runtime value.
AssetData.sourceChanged: boolean | undefined Editor-only status set when the external source differs from the last saved project metadata.
AssetData.sourceMap: ScriptSourceMap | undefined AssetData.sourceMap runtime value.
AssetData.sourceModifiedAt: number | undefined Last filesystem modification time observed when the external source was saved or loaded.
AssetData.sourcePath: string | undefined Project-relative source file used by desktop projects. Browser projects keep using inline src data.
AssetData.sourceText: string | undefined AssetData.sourceText runtime value.
AssetData.spriteFrame: SpriteFrameData | undefined AssetData.spriteFrame runtime value.
AssetData.spriteImport: SpriteImportSettings | undefined AssetData.spriteImport runtime value.
AssetData.src: string Resolved data URL while the project is open; omitted from desktop project files for external assets.
AssetData.type: AssetType AssetData.type runtime value.
AssetData.width: number | undefined AssetData.width runtime value.
Bounds2D scripting API.
interface Bounds2D src/runtime/scripting/Collider2D.ts:5 Bounds2D.center: Vector2 Bounds2D.center runtime value.
Bounds2D.max: Vector2 Bounds2D.max runtime value.
Bounds2D.min: Vector2 Bounds2D.min runtime value.
Bounds2D.size: Vector2 Bounds2D.size runtime value.
Detailed non-trigger collision callback data. Extends the other collider for backward compatibility.
class CollisionEvent2D src/runtime/scripting/PhysicsEvents2D.ts:8 CollisionEvent2D.component: Collider2DComponent CollisionEvent2D.component runtime value.
CollisionEvent2D.contacts: ContactPoint2D[] CollisionEvent2D.contacts runtime value.
CollisionEvent2D.containsPoint(point: Vector2Like): boolean Tests a world-space point against this collider's exact engine shape.
CollisionEvent2D.enabled: boolean CollisionEvent2D.enabled runtime value.
CollisionEvent2D.entity: RuntimeEntity CollisionEvent2D.entity runtime value.
CollisionEvent2D.getBounds(): Bounds2D Returns a world-axis-aligned bounding box.
CollisionEvent2D.getClosestPoint(point: Vector2Like): Vector2 Returns the closest point on or inside the collider in world space.
CollisionEvent2D.id: string CollisionEvent2D.id runtime value.
CollisionEvent2D.isTrigger: boolean CollisionEvent2D.isTrigger runtime value.
CollisionEvent2D.layer: string Collider filtering uses its owning entity's project layer.
CollisionEvent2D.material: PhysicsMaterial2D | null Physics material asset ID. Material assets are introduced in Collider Phase 2.
CollisionEvent2D.name: string CollisionEvent2D.name runtime value.
CollisionEvent2D.normal: Vector2 CollisionEvent2D.normal runtime value.
CollisionEvent2D.offset: Vector2 CollisionEvent2D.offset runtime value.
CollisionEvent2D.oneWay: boolean CollisionEvent2D.oneWay runtime value.
CollisionEvent2D.oneWayDirection: Vector2 Local direction of the solid face for one-way collision handling.
CollisionEvent2D.oneWayTolerance: number Positional tolerance in world units used near a one-way surface.
CollisionEvent2D.otherCollider: Collider2D CollisionEvent2D.otherCollider runtime value.
CollisionEvent2D.otherEntity: RuntimeEntity CollisionEvent2D.otherEntity runtime value.
CollisionEvent2D.relativeVelocity: Vector2 CollisionEvent2D.relativeVelocity runtime value.
CollisionEvent2D.selfCollider: Collider2D CollisionEvent2D.selfCollider runtime value.
ComponentConstructor scripting API.
type ComponentConstructor src/runtime/scene/SceneQuery.ts:6 ComponentConstructor.name: string ComponentConstructor.name runtime value.
ComponentQuery scripting API.
type ComponentQuery src/runtime/scene/SceneQuery.ts:7 One contact generated by a non-trigger collision.
interface ContactPoint2D src/runtime/scripting/PhysicsEvents2D.ts:5 ContactPoint2D.normal: Vector2 ContactPoint2D.normal runtime value.
ContactPoint2D.point: Vector2 ContactPoint2D.point runtime value.
ContactPoint2D.separation: number ContactPoint2D.separation runtime value.
Writes messages to the game console and the editor Console during Play Mode.
class Debug src/runtime/scripting/Debug.ts:10 Destroys an entity. With no argument, a script destroys its own entity.
destroy(target?: RuntimeEntity): void src/runtime/scripting/publicApi.ts:102 Drives DialogueBox entities: start/advance a conversation, pick a choice, or end it early. The runtime supplies the active implementation to user scripts.
DialogueApi src/runtime/scripting/publicApi.ts:61 Dialogue.advance(entityId: string): void Advances past the current line. No-op while the line has choices — pick one with choose() instead.
Dialogue.choose(entityId: string, choiceId: string): void Dialogue.choose runtime operation.
Dialogue.currentLineId(entityId: string): string | null Dialogue.currentLineId runtime operation.
Dialogue.end(entityId: string): void Ends the conversation early, destroying any spawned choice buttons and disabling the subtree.
Dialogue.isActive(entityId: string): boolean Dialogue.isActive runtime operation.
Dialogue.start(entityId: string): void Enables the DialogueBox entity's whole subtree and jumps to its startLineId.
Public shape of the Dialogue API exposed to scripts.
interface DialogueApi src/runtime/dialogue/DialogueSystem.ts:14 DialogueApi.advance(entityId: string): void Advances past the current line. No-op while the line has choices — pick one with choose() instead.
DialogueApi.choose(entityId: string, choiceId: string): void DialogueApi.choose runtime operation.
DialogueApi.currentLineId(entityId: string): string | null DialogueApi.currentLineId runtime operation.
DialogueApi.end(entityId: string): void Ends the conversation early, destroying any spawned choice buttons and disabling the subtree.
DialogueApi.isActive(entityId: string): boolean DialogueApi.isActive runtime operation.
DialogueApi.start(entityId: string): void Enables the DialogueBox entity's whole subtree and jumps to its startLineId.
A linear conversation with optional branching choices, driven by the runtime DialogueSystem.
"DialogueBox" src/runtime/index.ts:140 One clickable option shown when a DialogueLine has choices instead of a plain continue.
interface DialogueChoice src/shared/types/components.ts:269 DialogueChoice.id: string DialogueChoice.id runtime value.
DialogueChoice.nextLineId: string | null Line to jump to when this choice is picked. Null ends the conversation.
DialogueChoice.text: string DialogueChoice.text runtime value.
One page of dialogue: who's speaking, the line's text, and how the player moves past it.
interface DialogueLine src/shared/types/components.ts:277 DialogueLine.choices: DialogueChoice[] Empty means clicking/continuing advances straight to nextLineId instead of showing choice buttons.
DialogueLine.id: string DialogueLine.id runtime value.
DialogueLine.nextLineId: string | null Used only when choices is empty. Null ends the conversation.
DialogueLine.speaker: string Empty string hides the speaker label for this line.
DialogueLine.text: string DialogueLine.text runtime value.
EngineComponent scripting API.
type EngineComponent src/shared/types/components.ts:514 EngineComponent.enabled: boolean EngineComponent.enabled runtime value.
EngineComponent.type: "Transform" | "SpriteRenderer" | "TextRenderer" | "Camera2D" | "Rigidbody2D" | "BoxCollider2D" | "CircleCollider2D" | "CapsuleCollider2D" | "PolygonCollider2D" | "EdgeCollider2D" | "CompositeCollider2D" | "TilemapCollider2D" | "Animator" | "AudioSource" | "Script" | "Tilemap" | "ParticleEmitter" | "ParallaxLayer" | "Light2D" | "UICanvas" | "Anchor" | "UIButton" | "UIHoverAnimation" | "UIPanel" | "DialogueBox" EngineComponent.type runtime value.
Represents an object inside the active runtime scene.
class Entity src/runtime/core/RuntimeEntity.ts:30 Entity.active: boolean Alias for {@link enabled}.
Entity.addChild(child: RuntimeEntity): void Entity.addChild runtime operation.
Entity.addComponent(component: EngineComponent): void Adds a component and refreshes runtime systems. Script components may be added more than once.
Entity.addTag(tag: string): void Adds a unique serializable tag.
Entity.children: RuntimeEntity[] Direct child entities in serialized hierarchy order.
Entity.clone(): RuntimeEntity Clones this entity hierarchy into the active scene.
Entity.destroy(): void Destroys this entity and all of its children.
Entity.enabled: boolean Whether the entity is enabled in its scene.
Entity.events: OwnedEvents<Record<string, unknown>> Local signal bus. Script listeners are automatically removed on destruction.
Entity.exists: boolean Whether this runtime entity still exists in the active scene.
Entity.getComponent(type: "Animator"): RuntimeAnimator | undefined Returns the first component of the requested type.
Entity.getComponents<T extends ComponentType>(type: T): Extract<EngineComponent, { type: T; }>[] Returns every matching component; omit type to return all components.
Entity.getVelocity(): SharedVector2 Returns the current Matter.js body velocity.
Entity.hasComponent(type: ComponentType): boolean Returns whether an engine component is attached.
Entity.hasTag(tag: string): boolean Tests whether this entity contains a tag.
Entity.id: string Entity.id runtime value.
Entity.instantiate(template: EntityData | PrefabData, positionOrOptions?: Vector2Like | InstantiateOptions): RuntimeEntity Creates an independent runtime copy of entity data or a complete prefab hierarchy.
Entity.layer: string Named gameplay/physics layer.
Entity.name: string Display name serialized with the entity.
Entity.parent: RuntimeEntity | null Parent entity, or null for a scene root.
Entity.playAnimation(clipNameOrId: string): void Starts an Animator clip by its name or ID without restarting an already-playing clip.
Entity.playAudio(): void Starts this entity's enabled AudioSource component.
Entity.removeChild(child: RuntimeEntity): void Entity.removeChild runtime operation.
Entity.removeComponent(type: ComponentType, componentId?: string): void Removes components by type. Pass a script component ID to remove only that script instance.
Entity.removeTag(tag: string): void Removes a tag when present.
Entity.setActive(active: boolean): void Enables or disables this entity.
Entity.setParent(parent: RuntimeEntity | null): void Reparents this entity while preserving its local transform values.
Entity.setText(value: string): void Changes the first TextRenderer attached to this entity.
Entity.setVelocity(x: number, y: number): void Sets the Matter.js body velocity.
Entity.stopAnimation(): void Stops the animation currently playing on this entity.
Entity.tags: readonly string[] Serializable gameplay tags attached to the entity.
Entity.teleport(x: number, y: number): void Moves this entity immediately while keeping its physics body synchronized.
Entity.transform: RuntimeTransform Transform attached to this entity.
EntityData scripting API.
interface EntityData src/shared/types/scene.ts:3 EntityData.children: string[] EntityData.children runtime value.
EntityData.components: EngineComponent[] EntityData.components runtime value.
EntityData.enabled: boolean EntityData.enabled runtime value.
EntityData.id: string EntityData.id runtime value.
EntityData.layer: string | undefined Physics, rendering, and query layer. Defaults to `Default`.
EntityData.name: string EntityData.name runtime value.
EntityData.parentId: string | null EntityData.parentId runtime value.
EntityData.prefab: { prefabId: string; sourceEntityId: string; } | undefined EntityData.prefab runtime value.
EntityData.tags: string[] | undefined Gameplay classification. An entity may have any number of tags.
Small signal bus used by global Events and per-entity signals.
class EventBus src/runtime/events/Events.ts:8 EventBus.clear(): void EventBus.clear runtime operation.
EventBus.emit<K extends EventName<TEvents>>(name: K, ...args: EventArgs<TEvents, K>): void EventBus.emit runtime operation.
EventBus.off<K extends EventName<TEvents>>(name: K, callback: Listener<TEvents[K]>): void EventBus.off runtime operation.
EventBus.on<K extends EventName<TEvents>>(name: K, callback: Listener<TEvents[K]>, ownerId?: string): () => void EventBus.on runtime operation.
EventBus.removeOwner(ownerId: string): void EventBus.removeOwner runtime operation.
Public global signal placeholder replaced by the active runtime bus in user modules.
EventsApi src/runtime/events/Events.ts:73 Events.emit<K>(name: K, payload?: unknown): void Invokes current listeners with an optional payload.
Events.off<K>(name: K, callback: Listener<unknown>): void Removes matching listener registrations.
Events.on<K>(name: K, callback: Listener<unknown>): () => void Registers a listener and returns an unsubscribe callback. Script-owned listeners are cleaned up automatically.
EventsApi scripting API.
type EventsApi src/runtime/events/Events.ts:57 EventsApi.emit<K>(name: K, payload?: unknown): void Invokes current listeners with an optional payload.
EventsApi.off<K>(name: K, callback: Listener<unknown>): void Removes matching listener registrations.
EventsApi.on<K>(name: K, callback: Listener<unknown>): () => void Registers a listener and returns an unsubscribe callback. Script-owned listeners are cleaned up automatically.
Game scripting API.
class Game src/runtime/Game.ts:10 Game.loadProject(source: string | ProjectData): Promise<void> Game.loadProject runtime operation.
Game.loadScene(nameOrId: string): Promise<void> Game.loadScene runtime operation.
Game.options: GameOptions Game.options runtime value.
Game.start(inputTarget?: HTMLElement): Promise<GameRuntime> Game.start runtime operation.
Game.stop(): void Game.stop runtime operation.
Extend this interface through module augmentation to type global game events.
interface GameEvents src/runtime/events/Events.ts:2 GameRuntime scripting API.
class GameRuntime src/runtime/GameRuntime.ts:32 GameRuntime.dispatchUIEvent(entityId: string, type: "click" | "pointerenter" | "pointerexit" | "focus" | "blur"): void Forwards a Button interaction from the renderer to scripts and any active dialogue choice buttons.
GameRuntime.getScene(): SceneData GameRuntime.getScene runtime operation.
GameRuntime.loadScene(nameOrId: string): void GameRuntime.loadScene runtime operation.
GameRuntime.pause(): void GameRuntime.pause runtime operation.
GameRuntime.resume(): void GameRuntime.resume runtime operation.
GameRuntime.setTouchControlsPreview(visible: boolean): void Force-shows or hides the on-screen touch controls, for editors previewing mobile layout on a desktop pointer.
GameRuntime.start(inputTarget: HTMLElement): Promise<void> Loads persisted save data, then boots the first scene. Await this before assuming Save.get returns saved values.
GameRuntime.stop(): void GameRuntime.stop runtime operation.
GridCell scripting API.
interface GridCell src/engine/navigation/GridPathfinding.ts:1 GridCell.x: number GridCell.x runtime value.
GridCell.y: number GridCell.y runtime value.
Creates a runtime entity or prefab hierarchy with optional transform and parent overrides.
instantiate(template: EntityData | PrefabData, position?: Vector2 | InstantiateOptions): RuntimeEntity src/runtime/scripting/publicApi.ts:95 InstantiateOptions scripting API.
interface InstantiateOptions src/runtime/core/RuntimeEntity.ts:10 InstantiateOptions.parent: RuntimeEntity | null | undefined InstantiateOptions.parent runtime value.
InstantiateOptions.position: Vector2Like | undefined InstantiateOptions.position runtime value.
InstantiateOptions.rotation: number | undefined InstantiateOptions.rotation runtime value.
Allocation-free scalar math helpers for common 2D gameplay calculations.
{ clamp(value: number, min: number, max: number): number; lerp(a: number, b: number, t: number): number; inverseLerp(a: number, b: number, value: number): number; moveTowards(current: number, target: number, maxDelta: number): number; repeat(value: number, length: number): number; pingPong(value: number, length: number): number; degToRad(degrees: number): number; radToDeg(radians: number): number; approximately(a: number, b: number, epsilon?: number): boolean; } src/runtime/math/Math2D.ts:2 Math2D.approximately(a: number, b: number, epsilon?: number): boolean Compares floating-point values with a relative tolerance.
Math2D.clamp(value: number, min: number, max: number): number Constrains a scalar to an inclusive range.
Math2D.degToRad(degrees: number): number Converts degrees to radians.
Math2D.inverseLerp(a: number, b: number, value: number): number Returns the interpolation factor of value between a and b.
Math2D.lerp(a: number, b: number, t: number): number Linearly interpolates without clamping t.
Math2D.moveTowards(current: number, target: number, maxDelta: number): number Moves a scalar toward a target by no more than maxDelta.
Math2D.pingPong(value: number, length: number): number Oscillates a value between zero and length.
Math2D.radToDeg(radians: number): number Converts radians to degrees.
Math2D.repeat(value: number, length: number): number Wraps a value into the range 0..length.
OwnedEvents scripting API.
interface OwnedEvents src/runtime/events/Events.ts:42 OwnedEvents.emit<K extends EventName<TEvents>>(name: K, ...args: EventArgs<TEvents, K>): void Invokes current listeners with an optional payload.
OwnedEvents.off<K extends EventName<TEvents>>(name: K, callback: Listener<TEvents[K]>): void Removes matching listener registrations.
OwnedEvents.on<K extends EventName<TEvents>>(name: K, callback: Listener<TEvents[K]>): () => void Registers a listener and returns an unsubscribe callback. Script-owned listeners are cleaned up automatically.
ProjectData scripting API.
interface ProjectData src/shared/types/project.ts:93 ProjectData.activeSceneId: string ProjectData.activeSceneId runtime value.
ProjectData.animations: AnimationClip[] ProjectData.animations runtime value.
ProjectData.animatorControllers: AnimatorController[] ProjectData.animatorControllers runtime value.
ProjectData.assetFolders: AssetFolder[] | undefined Virtual folders shown in the Asset Browser. Optional for backwards-compatible project files.
ProjectData.assets: AssetData[] ProjectData.assets runtime value.
ProjectData.id: string ProjectData.id runtime value.
ProjectData.input: InputConfiguration ProjectData.input runtime value.
ProjectData.name: string ProjectData.name runtime value.
ProjectData.prefabs: PrefabData[] ProjectData.prefabs runtime value.
ProjectData.scenes: SceneData[] ProjectData.scenes runtime value.
ProjectData.schemaVersion: 1 ProjectData.schemaVersion runtime value.
ProjectData.settings: ProjectSettings ProjectData.settings runtime value.
Marks a script field as editable through the Inspector.
property(options?: PropertyOptions): PropertyDecorator src/runtime/scripting/property.ts:15 PropertyOptions scripting API.
interface PropertyOptions src/runtime/scripting/property.ts:3 PropertyOptions.label: string | undefined PropertyOptions.label runtime value.
PropertyOptions.max: number | undefined PropertyOptions.max runtime value.
PropertyOptions.min: number | undefined PropertyOptions.min runtime value.
PropertyOptions.options: string[] | undefined PropertyOptions.options runtime value.
PropertyOptions.step: number | undefined PropertyOptions.step runtime value.
PropertyOptions.type: ScriptPropertyKind | undefined PropertyOptions.type runtime value.
Represents an object inside the active runtime scene.
class RuntimeEntity src/runtime/core/RuntimeEntity.ts:30 RuntimeEntity.active: boolean Alias for {@link enabled}.
RuntimeEntity.addChild(child: RuntimeEntity): void RuntimeEntity.addChild runtime operation.
RuntimeEntity.addComponent(component: EngineComponent): void Adds a component and refreshes runtime systems. Script components may be added more than once.
RuntimeEntity.addTag(tag: string): void Adds a unique serializable tag.
RuntimeEntity.children: RuntimeEntity[] Direct child entities in serialized hierarchy order.
RuntimeEntity.clone(): RuntimeEntity Clones this entity hierarchy into the active scene.
RuntimeEntity.destroy(): void Destroys this entity and all of its children.
RuntimeEntity.enabled: boolean Whether the entity is enabled in its scene.
RuntimeEntity.events: OwnedEvents<Record<string, unknown>> Local signal bus. Script listeners are automatically removed on destruction.
RuntimeEntity.exists: boolean Whether this runtime entity still exists in the active scene.
RuntimeEntity.getComponent(type: "Animator"): RuntimeAnimator | undefined Returns the first component of the requested type.
RuntimeEntity.getComponents<T extends ComponentType>(type: T): Extract<EngineComponent, { type: T; }>[] Returns every matching component; omit type to return all components.
RuntimeEntity.getVelocity(): SharedVector2 Returns the current Matter.js body velocity.
RuntimeEntity.hasComponent(type: ComponentType): boolean Returns whether an engine component is attached.
RuntimeEntity.hasTag(tag: string): boolean Tests whether this entity contains a tag.
RuntimeEntity.id: string RuntimeEntity.id runtime value.
RuntimeEntity.instantiate(template: EntityData | PrefabData, positionOrOptions?: Vector2Like | InstantiateOptions): RuntimeEntity Creates an independent runtime copy of entity data or a complete prefab hierarchy.
RuntimeEntity.layer: string Named gameplay/physics layer.
RuntimeEntity.name: string Display name serialized with the entity.
RuntimeEntity.parent: RuntimeEntity | null Parent entity, or null for a scene root.
RuntimeEntity.playAnimation(clipNameOrId: string): void Starts an Animator clip by its name or ID without restarting an already-playing clip.
RuntimeEntity.playAudio(): void Starts this entity's enabled AudioSource component.
RuntimeEntity.removeChild(child: RuntimeEntity): void RuntimeEntity.removeChild runtime operation.
RuntimeEntity.removeComponent(type: ComponentType, componentId?: string): void Removes components by type. Pass a script component ID to remove only that script instance.
RuntimeEntity.removeTag(tag: string): void Removes a tag when present.
RuntimeEntity.setActive(active: boolean): void Enables or disables this entity.
RuntimeEntity.setParent(parent: RuntimeEntity | null): void Reparents this entity while preserving its local transform values.
RuntimeEntity.setText(value: string): void Changes the first TextRenderer attached to this entity.
RuntimeEntity.setVelocity(x: number, y: number): void Sets the Matter.js body velocity.
RuntimeEntity.stopAnimation(): void Stops the animation currently playing on this entity.
RuntimeEntity.tags: readonly string[] Serializable gameplay tags attached to the entity.
RuntimeEntity.teleport(x: number, y: number): void Moves this entity immediately while keeping its physics body synchronized.
RuntimeEntity.transform: RuntimeTransform Transform attached to this entity.
Live transform view for a runtime entity. Rotation is always measured clockwise in degrees.
class RuntimeTransform src/runtime/core/RuntimeTransform.ts:7 RuntimeTransform.localPosition: Vector2 RuntimeTransform.localPosition runtime value.
RuntimeTransform.localRotation: number RuntimeTransform.localRotation runtime value.
RuntimeTransform.localScale: Vector2 RuntimeTransform.localScale runtime value.
RuntimeTransform.localToWorld(point: Vector2Like): Vector2 RuntimeTransform.localToWorld runtime operation.
RuntimeTransform.lookAt(worldTarget: Vector2Like): void RuntimeTransform.lookAt runtime operation.
RuntimeTransform.parent: RuntimeTransform | null RuntimeTransform.parent runtime value.
RuntimeTransform.position: Vector2 World position. Setting it converts through the parent transform.
RuntimeTransform.rotate(degrees: number): void RuntimeTransform.rotate runtime operation.
RuntimeTransform.rotation: number RuntimeTransform.rotation runtime value.
RuntimeTransform.scale: Vector2 RuntimeTransform.scale runtime value.
RuntimeTransform.translate(offset: Vector2Like, local?: boolean): void RuntimeTransform.translate runtime operation.
RuntimeTransform.worldToLocal(point: Vector2Like): Vector2 RuntimeTransform.worldToLocal runtime operation.
Base class for user-authored gameplay scripts. Lifecycle for a new enabled instance: `awake → onEnable → start → update / fixedUpdate`. `awake` and `start` run exactly once per instance. Re-enabling calls `onEnable` again without repeating `start`. Disabling calls `onDisable`; removal or scene shutdown calls `onDisable` when active, followed by `onDestroy`.
class Script src/runtime/scripting/Script.ts:115 Script.awake(): void Called once immediately after the script is created and bound.
Script.entity: RuntimeEntity Script.entity runtime value.
Script.events: OwnedEvents<Record<string, unknown>> Script-owned global listeners are removed automatically during onDestroy.
Script.fixedUpdate(delta: number): void Called at a fixed timestep before each physics step.
Script.game: RuntimeGameContext Pause and resume controls for the current game runtime.
Script.input: InputReader Input actions configured by the current project.
Script.onAnimationEvent(event: AnimationEvent): void Called when the active AnimationClip crosses an authored event marker. Events fire on every matching loop and on both directions of ping-pong playback.
Script.onCollisionEnter(event: CollisionEvent2D): void Called on the first physics step that touches another non-trigger collider.
Script.onCollisionExit(event: CollisionEvent2D): void Called after contact with another non-trigger collider ends.
Script.onCollisionStay(event: CollisionEvent2D): void Called on physics steps while touching another non-trigger collider.
Script.onDestroy(): void Called once immediately before the script instance is discarded.
Script.onDisable(): void Called when the script transitions from enabled to disabled.
Script.onEnable(): void Called whenever the script transitions from disabled to enabled.
Script.onTriggerEnter(event: TriggerEvent2D): void Called on the first physics step that overlaps a trigger collider.
Script.onTriggerExit(event: TriggerEvent2D): void Called after overlap with a trigger collider ends.
Script.onTriggerStay(event: TriggerEvent2D): void Called on physics steps while overlapping a trigger collider.
Script.sceneManager: RuntimeSceneManager Scene loading API for the current game.
Script.start(): void Called once before the first update, after the first onEnable call.
Script.timer: { after(seconds: number, callback: () => void, options?: TimerOptions): TimerHandle; every(seconds: number, callback: () => void, options?: TimerOptions): TimerHandle; cancel(handle: TimerHandle): void; pause(handle: TimerHandle): void; resume(handle: TimerHandle): void; } Script-owned timers are cancelled automatically during onDestroy.
Script.transform: RuntimeTransform Shortcut for `entity.transform`.
Script.update(delta: number): void Called once per rendered frame while the script is enabled.
Mutable text component used by HUD, menus, labels, and dialog. Component token for dynamic text rendered by PixiJS.
"TextRenderer" src/runtime/index.ts:134 Public clock placeholder replaced with the active game's clock in user modules.
TimeApi src/runtime/time/Time.ts:42 Time.deltaTime: number Scaled duration of the current frame in seconds.
Time.elapsed: number Total scaled runtime duration.
Time.fixedDeltaTime: number Fixed physics timestep in seconds.
Time.frameCount: number Number of rendered runtime frames.
Time.timeScale: number Global gameplay speed. Set to zero to pause scaled gameplay.
Time.unscaledDeltaTime: number Real duration of the current frame, unaffected by timeScale.
Time.unscaledElapsed: number Total real runtime duration.
Public runtime clock. Durations are expressed in seconds; scaled values honor {@link timeScale}.
interface TimeApi src/runtime/time/Time.ts:2 TimeApi.deltaTime: number Scaled duration of the current frame in seconds.
TimeApi.elapsed: number Total scaled runtime duration.
TimeApi.fixedDeltaTime: number Fixed physics timestep in seconds.
TimeApi.frameCount: number Number of rendered runtime frames.
TimeApi.timeScale: number Global gameplay speed. Set to zero to pause scaled gameplay.
TimeApi.unscaledDeltaTime: number Real duration of the current frame, unaffected by timeScale.
TimeApi.unscaledElapsed: number Total real runtime duration.
Public timer placeholder replaced with the active game's scheduler in user modules.
TimerApi src/runtime/time/Timer.ts:69 Timer.after(seconds: number, callback: () => void, options?: TimerOptions): TimerHandle Runs callback once after a duration. Uses scaled time unless `unscaled` is true.
Timer.cancel(handle: TimerHandle): void Permanently cancels a timer handle.
Timer.every(seconds: number, callback: () => void, options?: TimerOptions): TimerHandle Repeats callback at an interval. Uses scaled time unless `unscaled` is true.
Timer.pause(handle: TimerHandle): void Suspends a timer without resetting its remaining duration.
Timer.resume(handle: TimerHandle): void Continues a paused timer.
TimerApi scripting API.
interface TimerApi src/runtime/time/Timer.ts:3 TimerApi.after(seconds: number, callback: () => void, options?: TimerOptions): TimerHandle Runs callback once after a duration. Uses scaled time unless `unscaled` is true.
TimerApi.cancel(handle: TimerHandle): void Permanently cancels a timer handle.
TimerApi.every(seconds: number, callback: () => void, options?: TimerOptions): TimerHandle Repeats callback at an interval. Uses scaled time unless `unscaled` is true.
TimerApi.pause(handle: TimerHandle): void Suspends a timer without resetting its remaining duration.
TimerApi.resume(handle: TimerHandle): void Continues a paused timer.
TimerHandle scripting API.
interface TimerHandle src/runtime/time/Timer.ts:1 TimerHandle.id: number TimerHandle.id runtime value.
TimerOptions scripting API.
interface TimerOptions src/runtime/time/Timer.ts:2 TimerOptions.unscaled: boolean | undefined TimerOptions.unscaled runtime value.
Semantic controls produced by Kriya's mobile virtual stick and action buttons. "left"/"right"/"up"/"down" are reserved for the stick; any other string is a custom button's `id`.
type TouchControl src/shared/types/project.ts:39 Stores local position, rotation, and scale for every entity.
interface Transform src/shared/types/components.ts:39 Transform.enabled: boolean Transform.enabled runtime value.
Transform.position: Vector2 Local position relative to the parent entity.
Transform.rotation: number Local clockwise rotation in degrees.
Transform.scale: Vector2 Local horizontal and vertical scale.
Transform.type: "Transform" Transform.type runtime value.
Detailed trigger overlap callback data. Extends the other collider for backward compatibility.
class TriggerEvent2D src/runtime/scripting/PhysicsEvents2D.ts:20 TriggerEvent2D.component: Collider2DComponent TriggerEvent2D.component runtime value.
TriggerEvent2D.containsPoint(point: Vector2Like): boolean Tests a world-space point against this collider's exact engine shape.
TriggerEvent2D.enabled: boolean TriggerEvent2D.enabled runtime value.
TriggerEvent2D.entity: RuntimeEntity TriggerEvent2D.entity runtime value.
TriggerEvent2D.getBounds(): Bounds2D Returns a world-axis-aligned bounding box.
TriggerEvent2D.getClosestPoint(point: Vector2Like): Vector2 Returns the closest point on or inside the collider in world space.
TriggerEvent2D.id: string TriggerEvent2D.id runtime value.
TriggerEvent2D.isTrigger: boolean TriggerEvent2D.isTrigger runtime value.
TriggerEvent2D.layer: string Collider filtering uses its owning entity's project layer.
TriggerEvent2D.material: PhysicsMaterial2D | null Physics material asset ID. Material assets are introduced in Collider Phase 2.
TriggerEvent2D.name: string TriggerEvent2D.name runtime value.
TriggerEvent2D.offset: Vector2 TriggerEvent2D.offset runtime value.
TriggerEvent2D.oneWay: boolean TriggerEvent2D.oneWay runtime value.
TriggerEvent2D.oneWayDirection: Vector2 Local direction of the solid face for one-way collision handling.
TriggerEvent2D.oneWayTolerance: number Positional tolerance in world units used near a one-way surface.
TriggerEvent2D.otherCollider: Collider2D TriggerEvent2D.otherCollider runtime value.
TriggerEvent2D.otherEntity: RuntimeEntity TriggerEvent2D.otherEntity runtime value.
TriggerEvent2D.selfCollider: Collider2D TriggerEvent2D.selfCollider runtime value.
A clickable UI element with configurable animated interaction feedback.
"UIButton" src/runtime/index.ts:137 Marks the root of a screen-space UI hierarchy (a HUD, menu, or dialog).
"UICanvas" src/runtime/index.ts:135 A non-visual layout container that arranges Anchor'd children in a row or column.
"UIPanel" src/runtime/index.ts:139 Mutable two-dimensional vector used by the public scripting API.
class Vector2 src/runtime/math/Vector2.ts:4 Vector2.add(value: Vector2Like): Vector2 Adds a vector in place.
Vector2.clone(): Vector2 Returns an independent copy.
Vector2.divide(value: number | Vector2Like): Vector2 Divides by a scalar or component-wise vector in place. Zero divisors produce zero.
Vector2.equals(other: Vector2Like, epsilon?: number): boolean Compares components within an optional epsilon.
Vector2.length: number Vector2.length runtime value.
Vector2.lengthSquared: number Vector2.lengthSquared runtime value.
Vector2.multiply(value: number | Vector2Like): Vector2 Multiplies by a scalar or component-wise vector in place.
Vector2.normalize(): Vector2 Normalizes this vector in place.
Vector2.normalized: Vector2 Vector2.normalized runtime value.
Vector2.set(x: number, y: number): Vector2 Vector2.set runtime operation.
Vector2.subtract(value: Vector2Like): Vector2 Subtracts a vector in place.
Vector2.toJSON(): Vector2Like Vector2.toJSON runtime operation.
Vector2.x: number Vector2.x runtime value.
Vector2.y: number Vector2.y runtime value.
Vector2Like scripting API.
interface Vector2Like src/runtime/math/Vector2.ts:1 Vector2Like.x: number Vector2Like.x runtime value.
Vector2Like.y: number Vector2Like.y runtime value.
PrefabData scripting API.
interface PrefabData src/shared/types/prefab.ts:3 PrefabData.entities: EntityData[] PrefabData.entities runtime value.
PrefabData.id: string PrefabData.id runtime value.
PrefabData.name: string PrefabData.name runtime value.
PrefabData.rootEntityId: string PrefabData.rootEntityId runtime value.
PrefabData.schemaVersion: 1 PrefabData.schemaVersion runtime value.
Public placeholder replaced with queries for the active runtime scene in user modules.
SceneQuery src/runtime/scene/SceneQuery.ts:36 Scene.findAllByTag(tag: string, options?: SceneQueryOptions): RuntimeEntity[] Returns all entities carrying a tag, optionally filtered by layer.
Scene.findAllWithComponent<T>(type: ComponentQuery<T>, options?: SceneQueryOptions): RuntimeEntity[] Returns all entities with an engine component token or user Script class.
Scene.findById(id: string): RuntimeEntity | null Finds an entity by its stable serialized ID.
Scene.findByName(name: string): RuntimeEntity | null Finds the first enabled or disabled entity with an exact display name.
Scene.findByTag(tag: string, options?: SceneQueryOptions): RuntimeEntity | null Finds the first entity carrying a tag. Cache this result instead of querying every update.
Scene.findWithComponent<T>(type: ComponentQuery<T>, options?: SceneQueryOptions): RuntimeEntity | null Finds the first entity with an engine component token or user Script class.
SceneData scripting API.
interface SceneData src/shared/types/scene.ts:27 SceneData.entities: EntityData[] SceneData.entities runtime value.
SceneData.id: string SceneData.id runtime value.
SceneData.name: string SceneData.name runtime value.
SceneData.rootEntityIds: string[] SceneData.rootEntityIds runtime value.
SceneData.schemaVersion: 1 SceneData.schemaVersion runtime value.
SceneData.settings: SceneSettings | undefined SceneData.settings runtime value.
Loads and inspects scenes in the active game runtime.
RuntimeSceneManager src/runtime/scripting/publicApi.ts:39 SceneManager.getActiveScene(): SceneData Returns the active mutable runtime scene.
SceneManager.loadScene(nameOrId: string): void Queues a scene by name or ID for loading before the next frame.
SceneManager.reloadScene(): void Reloads the active scene from its serialized project data.
Convenience queries over the active scene. Cache results instead of repeating broad queries every update.
class SceneQuery src/runtime/scene/SceneQuery.ts:10 SceneQuery.findAllByTag(tag: string, options?: SceneQueryOptions): RuntimeEntity[] Returns all entities carrying a tag, optionally filtered by layer.
SceneQuery.findAllWithComponent<T>(type: ComponentQuery<T>, options?: SceneQueryOptions): RuntimeEntity[] Returns all entities with an engine component token or user Script class.
SceneQuery.findById(id: string): RuntimeEntity | null Finds an entity by its stable serialized ID.
SceneQuery.findByName(name: string): RuntimeEntity | null Finds the first enabled or disabled entity with an exact display name.
SceneQuery.findByTag(tag: string, options?: SceneQueryOptions): RuntimeEntity | null Finds the first entity carrying a tag. Cache this result instead of querying every update.
SceneQuery.findWithComponent<T>(type: ComponentQuery<T>, options?: SceneQueryOptions): RuntimeEntity | null Finds the first entity with an engine component token or user Script class.
SceneQueryOptions scripting API.
interface SceneQueryOptions src/runtime/scene/SceneQuery.ts:5 SceneQueryOptions.layerMask: LayerMask | undefined SceneQueryOptions.layerMask runtime value.
Reads project input actions. The runtime supplies the active implementation to user scripts.
InputApi src/runtime/scripting/publicApi.ts:16 Input.gamepadConnected(index: number): boolean Returns whether a browser gamepad slot is connected.
Input.getAxis(actionName: string): number Returns a configured/conventional axis, or -1..1 from a negative/positive action pair.
Input.getGamepadAxis(index: number, axis: number): number Reads a gamepad axis in the range -1 through 1.
Input.getGamepadButton(index: number, button: number): boolean Returns whether a gamepad button is currently pressed.
Input.getGamepadButtonDown(index: number, button: number): boolean Input.getGamepadButtonDown runtime operation.
Input.getGamepadButtonUp(index: number, button: number): boolean Input.getGamepadButtonUp runtime operation.
Input.isJustPressed(actionName: string): boolean Returns true only on the frame an input action begins.
Input.isJustReleased(actionName: string): boolean Returns true only on the frame an input action ends.
Input.isPressed(actionName: string): boolean Returns true while an input action is held.
Input.mouseButton(button: number): boolean Returns true while a zero-based mouse button is held.
Input.mouseButtonDown(button: number): boolean Returns true only on the frame a mouse button is pressed.
Input.mouseButtonUp(button: number): boolean Returns true only on the frame a mouse button is released.
Input.mousePosition: SharedVector2 Pointer position relative to the game viewport in screen pixels.
Input.mouseWorldPosition: SharedVector2 Pointer position converted through the primary runtime camera.
Input.touchControl(control: TouchControl): boolean Reads one semantic virtual-stick or mobile action control.
Input.touches: readonly SharedVector2[] Active touch positions relative to the game viewport.
Input.touchStick: SharedVector2 Current virtual analog stick drag, each axis in -1..1. Zero when no stick touch is active.
InputBinding scripting API.
type InputBinding src/shared/types/project.ts:31 InputBinding.kind: "key" | "mouse" | "gamepad-button" | "gamepad-axis" | "touch" InputBinding.kind runtime value.
InputConfiguration scripting API.
interface InputConfiguration src/shared/types/project.ts:85 InputConfiguration.actions: InputActionDefinition[] InputConfiguration.actions runtime value.
InputConfiguration.deviceBindingsVersion: 1 | undefined Migration marker so user-removed gamepad/touch bindings are not recreated on every load.
InputConfiguration.touchControls: TouchControlsSettings | undefined On-screen virtual stick/button layout for touch devices. Filled in with defaults by withDefaultDeviceBindings when absent.
Best for walls, platforms, boxes, and simple rectangular props.
"BoxCollider2D" src/runtime/index.ts:116 Best for player characters, NPCs, and enemies.
"CapsuleCollider2D" src/runtime/index.ts:120 CapsuleQueryOptions scripting API.
interface CapsuleQueryOptions src/runtime/physics/Physics2D.ts:10 CapsuleQueryOptions.direction: "vertical" | "horizontal" | undefined CapsuleQueryOptions.direction runtime value.
CapsuleQueryOptions.includeTriggers: boolean | undefined CapsuleQueryOptions.includeTriggers runtime value.
CapsuleQueryOptions.layerMask: LayerMask | undefined CapsuleQueryOptions.layerMask runtime value.
CapsuleQueryOptions.rotation: number | undefined CapsuleQueryOptions.rotation runtime value.
Best for balls, circular objects, and inexpensive detection areas.
"CircleCollider2D" src/runtime/index.ts:118 Backend-independent collider view used by scripts, queries, and physics callbacks.
class Collider2D src/runtime/scripting/Collider2D.ts:13 Collider2D.component: Collider2DComponent Collider2D.component runtime value.
Collider2D.containsPoint(point: Vector2Like): boolean Tests a world-space point against this collider's exact engine shape.
Collider2D.enabled: boolean Collider2D.enabled runtime value.
Collider2D.entity: RuntimeEntity Collider2D.entity runtime value.
Collider2D.getBounds(): Bounds2D Returns a world-axis-aligned bounding box.
Collider2D.getClosestPoint(point: Vector2Like): Vector2 Returns the closest point on or inside the collider in world space.
Collider2D.id: string Collider2D.id runtime value.
Collider2D.isTrigger: boolean Collider2D.isTrigger runtime value.
Collider2D.layer: string Collider filtering uses its owning entity's project layer.
Collider2D.material: PhysicsMaterial2D | null Physics material asset ID. Material assets are introduced in Collider Phase 2.
Collider2D.name: string Collider2D.name runtime value.
Collider2D.offset: Vector2 Collider2D.offset runtime value.
Collider2D.oneWay: boolean Collider2D.oneWay runtime value.
Collider2D.oneWayDirection: Vector2 Local direction of the solid face for one-way collision handling.
Collider2D.oneWayTolerance: number Positional tolerance in world units used near a one-way surface.
Combines several simple shapes under one collider identity.
"CompositeCollider2D" src/runtime/index.ts:126 CompositeColliderShape2D scripting API.
type CompositeColliderShape2D src/shared/types/components.ts:417 CompositeColliderShape2D.enabled: boolean CompositeColliderShape2D.enabled runtime value.
CompositeColliderShape2D.id: string CompositeColliderShape2D.id runtime value.
CompositeColliderShape2D.name: string CompositeColliderShape2D.name runtime value.
CompositeColliderShape2D.offset: Vector2 CompositeColliderShape2D.offset runtime value.
CompositeColliderShape2D.rotation: number Clockwise local rotation in degrees.
CompositeColliderShape2D.type: "box" | "circle" | "capsule" | "polygon" CompositeColliderShape2D.type runtime value.
Best for terrain surfaces, ground contours, and open level boundaries.
"EdgeCollider2D" src/runtime/index.ts:124 Immutable collection of entity layer names used by physics and scene queries.
class LayerMask src/runtime/physics/LayerMask.ts:2 LayerMask.includes(layer: string): boolean Returns whether the mask contains a layer.
LayerMask.toArray(): string[] LayerMask.toArray runtime operation.
Public placeholder replaced with the active runtime physics query API in user modules.
Physics2DApi src/runtime/physics/Physics2D.ts:66 Physics2D.boxCast(origin: Vector2Like, size: Vector2Like, direction: Vector2Like, options?: ShapeCastOptions): RaycastHit2D | null Sweeps a box using the backend's conservative native-width query.
Physics2D.capsuleCast(origin: Vector2Like, size: Vector2Like, direction: Vector2Like, options?: ShapeCastOptions): RaycastHit2D | null Sweeps a capsule using its minor axis as the query width.
Physics2D.circleCast(origin: Vector2Like, radius: number, direction: Vector2Like, options?: ShapeCastOptions): RaycastHit2D | null Sweeps a circle and returns the nearest collider hit.
Physics2D.linecast(start: Vector2Like, end: Vector2Like, options?: PhysicsQueryOptions): RaycastHit2D | null Casts a zero-width segment from start to end.
Physics2D.overlapBox(center: Vector2Like, size: Vector2Like, options?: PhysicsQueryOptions & { rotation?: number; }): Collider2D[] Physics2D.overlapBox runtime operation.
Physics2D.overlapCapsule(center: Vector2Like, size: Vector2Like, options?: CapsuleQueryOptions): Collider2D[] Returns colliders overlapping a capsule probe.
Physics2D.overlapCircle(center: Vector2Like, radius: number, options?: PhysicsQueryOptions): Collider2D[] Returns colliders overlapping a world-space circle.
Physics2D.overlapPoint(point: Vector2Like, options?: PhysicsQueryOptions): Collider2D[] Returns colliders containing a world-space point.
Physics2D.raycast(origin: Vector2Like, direction: Vector2Like, options?: RaycastOptions): RaycastHit2D | null Casts a ray and returns the nearest hit. Triggers are excluded unless `includeTriggers` is true.
Physics2D.raycastAll(origin: Vector2Like, direction: Vector2Like, options?: RaycastOptions): RaycastHit2D[] Casts a ray and returns every matching hit sorted nearest-first.
Reusable backend-independent material applied to Collider2D shapes.
interface PhysicsMaterial2D src/shared/types/assets.ts:82 PhysicsMaterial2D.bounciness: number Elasticity in the range 0..1.
PhysicsMaterial2D.density: number Mass per unit area. Must be greater than zero.
PhysicsMaterial2D.friction: number Surface resistance in the range 0..1.
PhysicsMaterial2D.id: string PhysicsMaterial2D.id runtime value.
PhysicsMaterial2D.name: string PhysicsMaterial2D.name runtime value.
PhysicsQueryOptions scripting API.
interface PhysicsQueryOptions src/runtime/physics/Physics2D.ts:8 PhysicsQueryOptions.includeTriggers: boolean | undefined PhysicsQueryOptions.includeTriggers runtime value.
PhysicsQueryOptions.layerMask: LayerMask | undefined PhysicsQueryOptions.layerMask runtime value.
Best for irregular objects and complex static geometry; prefer simple shapes when possible.
"PolygonCollider2D" src/runtime/index.ts:122 RaycastHit2D scripting API.
interface RaycastHit2D src/runtime/physics/Physics2D.ts:12 RaycastHit2D.collider: Collider2D RaycastHit2D.collider runtime value.
RaycastHit2D.distance: number RaycastHit2D.distance runtime value.
RaycastHit2D.entity: RuntimeEntity RaycastHit2D.entity runtime value.
RaycastHit2D.normal: Vector2 RaycastHit2D.normal runtime value.
RaycastHit2D.point: Vector2 RaycastHit2D.point runtime value.
RaycastOptions scripting API.
interface RaycastOptions src/runtime/physics/Physics2D.ts:9 RaycastOptions.distance: number | undefined RaycastOptions.distance runtime value.
RaycastOptions.includeTriggers: boolean | undefined RaycastOptions.includeTriggers runtime value.
RaycastOptions.layerMask: LayerMask | undefined RaycastOptions.layerMask runtime value.
Component tokens accepted by Entity and Scene component queries.
"Rigidbody2D" src/runtime/index.ts:114 ShapeCastOptions scripting API.
interface ShapeCastOptions src/runtime/physics/Physics2D.ts:11 ShapeCastOptions.capsuleDirection: "vertical" | "horizontal" | undefined ShapeCastOptions.capsuleDirection runtime value.
ShapeCastOptions.distance: number | undefined ShapeCastOptions.distance runtime value.
ShapeCastOptions.includeTriggers: boolean | undefined ShapeCastOptions.includeTriggers runtime value.
ShapeCastOptions.layerMask: LayerMask | undefined ShapeCastOptions.layerMask runtime value.
ShapeCastOptions.rotation: number | undefined ShapeCastOptions.rotation runtime value.
Best for optimized collision geometry generated from Tilemap collision layers.
"TilemapCollider2D" src/runtime/index.ts:128 Builds optimized static collision geometry from Tilemap collision layers.
interface TilemapCollider2DComponent src/shared/types/components.ts:426 TilemapCollider2DComponent.collisionLayerIds: string[] Empty uses every enabled Tilemap layer marked for collision.
TilemapCollider2DComponent.enabled: boolean TilemapCollider2DComponent.enabled runtime value.
TilemapCollider2DComponent.id: string Stable instance ID used when an entity owns multiple colliders.
TilemapCollider2DComponent.isTrigger: boolean TilemapCollider2DComponent.isTrigger runtime value.
TilemapCollider2DComponent.materialId: string | null Reserved asset ID for the reusable PhysicsMaterial2D system.
TilemapCollider2DComponent.mergeAdjacent: boolean Greedily merges adjacent solid cells into larger rectangles.
TilemapCollider2DComponent.name: string Optional gameplay-facing name, such as MainBody or Feet.
TilemapCollider2DComponent.offset: Vector2 TilemapCollider2DComponent.offset runtime value.
TilemapCollider2DComponent.oneWay: boolean Makes compatible solid colliders passable from the back side.
TilemapCollider2DComponent.oneWayDirection: Vector2 World-facing local direction of the solid side.
TilemapCollider2DComponent.oneWayTolerance: number TilemapCollider2DComponent.oneWayTolerance runtime value.
TilemapCollider2DComponent.type: "TilemapCollider2D" TilemapCollider2DComponent.type runtime value.
Serializable property or sprite animation asset.
interface AnimationClip src/shared/types/animation.ts:70 AnimationClip.duration: number AnimationClip.duration runtime value.
AnimationClip.events: AnimationEventMarker[] | undefined Authored callbacks fired when playback crosses their timeline position.
AnimationClip.fps: number | undefined Global frame rate for sprite clips.
AnimationClip.frames: SpriteAnimationFrame[] | undefined Ordered sprite-frame asset references.
AnimationClip.id: string AnimationClip.id runtime value.
AnimationClip.loop: boolean AnimationClip.loop runtime value.
AnimationClip.name: string AnimationClip.name runtime value.
AnimationClip.playback: AnimationPlaybackMode | undefined Explicit playback behavior. `loop` remains for backwards compatibility.
AnimationClip.speed: number AnimationClip.speed runtime value.
AnimationClip.tracks: AnimationTrack[] AnimationClip.tracks runtime value.
AnimationClip.type: "property" | "sprite" | undefined Legacy/property clips default to `property`; newly-created frame clips use `sprite`.
Runtime payload delivered to Script.onAnimationEvent when playback crosses a marker.
interface AnimationEvent src/shared/types/animation.ts:54 AnimationEvent.booleanValue: boolean | undefined Optional authored boolean parameter.
AnimationEvent.frame: number Zero-based sprite frame index, or -1 for property clips.
AnimationEvent.name: string Authored marker name used to select gameplay behavior.
AnimationEvent.normalizedTime: number Marker time divided by the authored clip duration, in the range zero through one.
AnimationEvent.numberValue: number | undefined Optional authored numeric parameter.
AnimationEvent.stringValue: string | undefined Optional authored string parameter.
Serializable event marker authored on an AnimationClip timeline.
interface AnimationEventMarker src/shared/types/animation.ts:34 AnimationEventMarker.booleanValue: boolean | undefined AnimationEventMarker.booleanValue runtime value.
AnimationEventMarker.frameId: string | undefined Optional sprite frame identity used to keep frame-authored events attached while reordering.
AnimationEventMarker.id: string AnimationEventMarker.id runtime value.
AnimationEventMarker.name: string AnimationEventMarker.name runtime value.
AnimationEventMarker.numberValue: number | undefined AnimationEventMarker.numberValue runtime value.
AnimationEventMarker.stringValue: string | undefined AnimationEventMarker.stringValue runtime value.
AnimationEventMarker.time: number Local clip time in seconds.
AnimationPlaybackMode scripting API.
type AnimationPlaybackMode src/shared/types/animation.ts:31 One named state backed by an AnimationClip asset.
interface AnimationState src/shared/types/animator.ts:15 AnimationState.clipId: string | null AnimationState.clipId runtime value.
AnimationState.id: string AnimationState.id runtime value.
AnimationState.name: string AnimationState.name runtime value.
AnimationState.position: Vector2 AnimationState.position runtime value.
AnimationState.speed: number AnimationState.speed runtime value.
Animator scripting API.
"Animator" src/runtime/index.ts:129 Serializable state machine used by Animator components.
interface AnimatorController src/shared/types/animator.ts:47 AnimatorController.defaultStateId: string | null AnimatorController.defaultStateId runtime value.
AnimatorController.id: string AnimatorController.id runtime value.
AnimatorController.name: string AnimatorController.name runtime value.
AnimatorController.parameters: AnimatorParameter[] AnimatorController.parameters runtime value.
AnimatorController.states: AnimationState[] AnimatorController.states runtime value.
AnimatorController.transitions: AnimatorTransition[] AnimatorController.transitions runtime value.
Serializable parameter declaration and its initial value.
interface AnimatorParameter src/shared/types/animator.ts:7 AnimatorParameter.defaultValue: number | boolean AnimatorParameter.defaultValue runtime value.
AnimatorParameter.id: string AnimatorParameter.id runtime value.
AnimatorParameter.name: string AnimatorParameter.name runtime value.
AnimatorParameter.type: AnimatorParameterType AnimatorParameter.type runtime value.
Supported Animator Controller parameter kinds.
type AnimatorParameterType src/shared/types/animator.ts:4 Directed state-machine transition. `fromStateId: null` means Any State.
interface AnimatorTransition src/shared/types/animator.ts:34 AnimatorTransition.conditions: AnimatorTransitionCondition[] AnimatorTransition.conditions runtime value.
AnimatorTransition.duration: number Reserved state timing in seconds; sprite textures are not cross-faded.
AnimatorTransition.exitTime: number Normalized state time. A value of 1 waits for one complete playback.
AnimatorTransition.fromStateId: string | null AnimatorTransition.fromStateId runtime value.
AnimatorTransition.hasExitTime: boolean AnimatorTransition.hasExitTime runtime value.
AnimatorTransition.id: string AnimatorTransition.id runtime value.
AnimatorTransition.toStateId: string AnimatorTransition.toStateId runtime value.
Parameter predicate required by a transition.
interface AnimatorTransitionCondition src/shared/types/animator.ts:26 AnimatorTransitionCondition.id: string AnimatorTransitionCondition.id runtime value.
AnimatorTransitionCondition.operator: AnimatorConditionOperator AnimatorTransitionCondition.operator runtime value.
AnimatorTransitionCondition.parameterId: string AnimatorTransitionCondition.parameterId runtime value.
AnimatorTransitionCondition.value: number | boolean AnimatorTransitionCondition.value runtime value.
Public script-facing controller for an Entity's Animator component.
class RuntimeAnimator src/runtime/animation/RuntimeAnimator.ts:26 RuntimeAnimator.currentAnimation: string | null Current AnimationClip name.
RuntimeAnimator.currentState: string | null Current controller state name, or null for direct clip playback.
RuntimeAnimator.getBool(name: string): boolean Returns a Bool parameter, or false when it is missing.
RuntimeAnimator.getFloat(name: string): number Returns a Float parameter, or zero when it is missing.
RuntimeAnimator.getInteger(name: string): number Returns an Integer parameter, or zero when it is missing.
RuntimeAnimator.hasAnimation(name: string): boolean Returns whether the Animator can play a named AnimationClip.
RuntimeAnimator.hasState(name: string): boolean Returns whether the assigned controller contains a state.
RuntimeAnimator.isPlaying: boolean Whether animation time is currently advancing.
RuntimeAnimator.normalizedTime: number Elapsed state time divided by clip duration. Looping states may exceed one.
RuntimeAnimator.onComplete(animationName: string, callback: () => void): () => void Runs a callback when a state or clip completes. Looping clips notify once per cycle. The returned function unsubscribes early; Script-owned subscriptions are also removed automatically when their Script is destroyed.
RuntimeAnimator.pause(): void Pauses playback at the current frame.
RuntimeAnimator.play(stateOrClipName: string): void Plays a controller state, or an AnimationClip when no matching state exists.
RuntimeAnimator.playClip(clip: AnimationClip | string): void Directly plays an AnimationClip reference, name, or ID. State playback remains recommended.
RuntimeAnimator.resetTrigger(name: string): void Clears a Trigger parameter without taking a transition.
RuntimeAnimator.resume(): void Resumes playback from the current frame.
RuntimeAnimator.setBool(name: string, value: boolean): void Sets a Bool parameter used by controller transitions.
RuntimeAnimator.setFloat(name: string, value: number): void Sets a Float parameter used by controller transitions.
RuntimeAnimator.setInteger(name: string, value: number): void Sets an Integer parameter used by controller transitions.
RuntimeAnimator.setTrigger(name: string): void Arms a Trigger parameter until a matching transition consumes it.
RuntimeAnimator.speed: number Effective component playback multiplier.
RuntimeAnimator.stop(): void Stops playback and rewinds the current state.
One sprite frame reference and optional timing override.
interface SpriteAnimationFrame src/shared/types/animation.ts:24 SpriteAnimationFrame.duration: number | undefined When omitted, duration is derived from the clip FPS.
SpriteAnimationFrame.id: string SpriteAnimationFrame.id runtime value.
SpriteAnimationFrame.spriteAssetId: string SpriteAnimationFrame.spriteAssetId runtime value.
Motion and color-transition settings applied as a UIButton changes interaction state.
interface UIButtonAnimationConfig src/shared/types/components.ts:178 UIButtonAnimationConfig.easing: UIButtonAnimationEasing UIButtonAnimationConfig.easing runtime value.
UIButtonAnimationConfig.enabled: boolean UIButtonAnimationConfig.enabled runtime value.
UIButtonAnimationConfig.focusedScale: number UIButtonAnimationConfig.focusedScale runtime value.
UIButtonAnimationConfig.focusPulse: boolean UIButtonAnimationConfig.focusPulse runtime value.
UIButtonAnimationConfig.focusPulseAmount: number UIButtonAnimationConfig.focusPulseAmount runtime value.
UIButtonAnimationConfig.focusPulseSpeed: number Focus pulse cycles per second.
UIButtonAnimationConfig.hoverScale: number UIButtonAnimationConfig.hoverScale runtime value.
UIButtonAnimationConfig.pressDuration: number Duration in seconds for the faster pressed-state response.
UIButtonAnimationConfig.pressedScale: number UIButtonAnimationConfig.pressedScale runtime value.
UIButtonAnimationConfig.releaseBounce: number Temporary scale overshoot after releasing a pressed button.
UIButtonAnimationConfig.transitionDuration: number Duration in seconds for hover, focus, disabled, and release transitions.
UIButtonAnimationEasing scripting API.
type UIButtonAnimationEasing src/shared/types/components.ts:175 Cursor-hover motion for any anchored UI visual.
"UIHoverAnimation" src/runtime/index.ts:138 Adds cursor-hover motion to any anchored UI image, text, button, or panel background.
interface UIHoverAnimationComponent src/shared/types/components.ts:240 UIHoverAnimationComponent.easing: UIButtonAnimationEasing UIHoverAnimationComponent.easing runtime value.
UIHoverAnimationComponent.enabled: boolean UIHoverAnimationComponent.enabled runtime value.
UIHoverAnimationComponent.hoverAlpha: number Target opacity at full hover.
UIHoverAnimationComponent.hoverOffset: Vector2 Screen-pixel offset applied at full hover.
UIHoverAnimationComponent.hoverRotation: number Clockwise rotation in degrees applied at full hover.
UIHoverAnimationComponent.hoverScale: number Scale multiplier around the element's UI rectangle center.
UIHoverAnimationComponent.pointerCursor: boolean Shows a pointer cursor while the element is hovered.
UIHoverAnimationComponent.transitionDuration: number Duration in seconds when entering or leaving the hovered state.
UIHoverAnimationComponent.type: "UIHoverAnimation" UIHoverAnimationComponent.type runtime value.
Camera2D scripting API.
"Camera2D" src/runtime/index.ts:130 SpriteRenderer scripting API.
"SpriteRenderer" src/runtime/index.ts:132 Stores one layer-based tile grid and optional collision layers.
interface Tilemap src/shared/types/components.ts:480 Tilemap.activeLayerId: string Tilemap.activeLayerId runtime value.
Tilemap.columns: number Tilemap.columns runtime value.
Tilemap.enabled: boolean Tilemap.enabled runtime value.
Tilemap.layers: TilemapLayer[] Tilemap.layers runtime value.
Tilemap.rows: number Tilemap.rows runtime value.
Tilemap.sortingLayer: number Draw order among world objects. Higher values render in front of lower values.
Tilemap.tilesetAssetId: string | null Tilemap.tilesetAssetId runtime value.
Tilemap.tilesetColumns: number Tilemap.tilesetColumns runtime value.
Tilemap.tileSize: Vector2 Tilemap.tileSize runtime value.
Tilemap.type: "Tilemap" Tilemap.type runtime value.
TilemapAutotile scripting API.
interface TilemapAutotile src/shared/types/components.ts:506 TilemapAutotile.baseTile: number Palette tile used as the start of the default sequential 16-tile rule set.
TilemapAutotile.enabled: boolean TilemapAutotile.enabled runtime value.
TilemapAutotile.ruleTiles: number[] Tile index for every 4-neighbor mask from 0 through 15.
TilemapLayer scripting API.
interface TilemapLayer src/shared/types/components.ts:493 TilemapLayer.autotile: TilemapAutotile | undefined Optional 4-neighbor autotile mapping. Rule index bits are north=1, east=2, south=4, west=8.
TilemapLayer.collision: boolean TilemapLayer.collision runtime value.
TilemapLayer.enabled: boolean TilemapLayer.enabled runtime value.
TilemapLayer.id: string TilemapLayer.id runtime value.
TilemapLayer.name: string TilemapLayer.name runtime value.
TilemapLayer.opacity: number TilemapLayer.opacity runtime value.
TilemapLayer.tiles: number[] TilemapLayer.tiles runtime value.
TilemapLayer.tilesetAssetId: string | null | undefined Overrides the Tilemap's default tileset for this layer.
AudioSource scripting API.
"AudioSource" src/runtime/index.ts:131 Persistent key-value store for game progress. The runtime supplies the active implementation to user scripts.
SaveApi src/runtime/scripting/publicApi.ts:48 Save.clear(): void Save.clear runtime operation.
Save.delete(key: string): void Save.delete runtime operation.
Save.get<T = unknown>(key: string, fallback?: T | null): T | null Save.get runtime operation.
Save.has(key: string): boolean Save.has runtime operation.
Save.keys(): string[] Save.keys runtime operation.
Save.set(key: string, value: unknown): void Save.set runtime operation.
Public shape of the Save API exposed to scripts.
interface SaveApi src/runtime/save/SaveSystem.ts:4 SaveApi.clear(): void SaveApi.clear runtime operation.
SaveApi.delete(key: string): void SaveApi.delete runtime operation.
SaveApi.get<T = unknown>(key: string, fallback?: T | null): T | null SaveApi.get runtime operation.
SaveApi.has(key: string): boolean SaveApi.has runtime operation.
SaveApi.keys(): string[] SaveApi.keys runtime operation.
SaveApi.set(key: string, value: unknown): void SaveApi.set runtime operation.