---
title: "Script SDK Surface"
description: "Sources: `packages/script-sdk/src/index.ts`."
engineVersion: v1.0.234
date: 2026-09-28
license: "(c) Gessa, proprietary. Cite with attribution to https://gessa.ai/docs/. Terms: https://gessa.ai/terms/."
canonical: https://gessa.ai/docs/spec/generated/script-sdk/
---
<!-- GENERATED FILE: do not edit by hand. -->
<!-- Regenerate with `npm run gen-docs`. -->

Sources: `packages/script-sdk/src/index.ts`.

# Script SDK Surface

This generated snapshot documents the current TypeScript script SDK shape. `ScriptContext` is the canonical aggregate available to scripts; host interfaces below are the supported namespace surfaces exposed through `ctx.*`.

Project-defined components are production-grade backend-validated project-local data contracts, not canonical engine atomics. Static ECS payload typing comes from built-in component contracts exposed through `BuiltInComponentPayload`, `BuiltInComponentPatch`, `EngineComponentCatalog`, and `ctx.entity.*Component<T extends BuiltInComponentType>(...)` accessors.

## ScriptContext

| Context key | Declaration |
| --- | --- |
| `assets` | `readonly assets: AssetCatalog;` |
| `components` | `readonly components: Record<string, ComponentPayload>;` |
| `componentTypes` | `readonly componentTypes: EngineComponentCatalog;` |
| `uiTypes` | `readonly uiTypes: UIEngineCatalog;` |
| `room` | `readonly room: RoomHost;` |
| `players` | `readonly players: PlayersHost;` |
| `player` | `readonly player: Player \| undefined;` |
| `match` | `readonly match: MatchHost;` |
| `team` | `readonly team: TeamHost;` |
| `commerce` | `readonly commerce: CommerceHost;` |
| `inventory` | `readonly inventory: InventoryHost;` |
| `ui` | `readonly ui: UiHost;` |
| `warehouse` | `readonly warehouse: WarehouseHost;` |
| `audio` | `readonly audio: AudioHost;` |
| `fx` | `readonly fx: FxHost;` |
| `physics` | `readonly physics: PhysicsHost;` |
| `tween` | `readonly tween: TweenHost;` |
| `navigation` | `readonly navigation: NavigationHost;` |
| `terrain` | `readonly terrain: TerrainHost;` |
| `water` | `readonly water: WaterHost;` |
| `world` | `readonly world: WorldHost;` |
| `events` | `readonly events: CustomEventHost;` |
| `network` | `readonly network: NetworkHost;` |
| `platform` | `readonly platform: PlatformHost;` |
| `camera` | `readonly camera: CameraHost;` |
| `script` | `readonly script: ScriptRuntimeSelf;` |
| `entity` | `readonly entity: EntityAccessor;` |
| `props` | `readonly props: Record<string, unknown>;` |
| `tickedAt` | `readonly tickedAt: string;` |
| `delta` | `readonly delta: number;` |
| `trigger` | `readonly trigger: string;` |
| `random` | `readonly random: RandomHost;` |
| `debug` | `readonly debug: LogHost;` |
| `info` | `readonly info: LogHost;` |
| `warn` | `readonly warn: LogHost;` |
| `error` | `readonly error: LogHost;` |
| `log` | `readonly log: LogHost;` |
| `timer` | `readonly timer: TimerHost;` |
| `isAuthority` | `readonly isAuthority: boolean;` |

## Host Interfaces

| Interface | Members | Declarations |
| --- | --- | --- |
| `AudioHost` | 5 | `play(assetId: ProjectAssetId, options?: AudioPlayOptions): AudioHandle;`<br>`playSpatial(assetId: ProjectAssetId, position: Vector3, options?: AudioPlayOptions): AudioHandle;`<br>`stop(handle: AudioHandle): void;`<br>`setVolume(handle: AudioHandle, volume: number): void;`<br>`setBackgroundMusic(assetId: ProjectAssetId, options?: AudioPlayOptions): AudioHandle;` |
| `AuthoringSdkHost` | 9 | `readonly project: ProjectAuthoringSdkHost;`<br>`readonly entity: EntityAuthoringHost;`<br>`readonly component: ComponentAuthoringHost;`<br>`readonly script: ScriptAuthoringHost;`<br>`readonly material: MaterialAuthoringHost;`<br>`readonly prefab: PrefabAuthoringHost;`<br>`readonly instance: InstanceAuthoringHost;`<br>`readonly world: WorldAuthoringHost;`<br>`readonly reference: ReferenceAuthoringHost;` |
| `CameraHost` | 4 | `addLookInput(delta: Vector3): void;`<br>`setLookSensitivity(degreesPerUnit: number): void;`<br>`setPitchClamp(minDeg: number, maxDeg: number): void;`<br>`setViewTarget(target: string, offset?: Vector3): void;` |
| `CommerceHost` | 2 | `promptPurchase(offerKey: string, audience?: PresentationAudience): void;`<br>`owns(entitlementKey: string, playerSessionId?: string): boolean;` |
| `ComponentAuthoringHost` | 5 | `put(entityId: string, componentKey: string, value: Record<string, unknown>, options?: ComponentAuthoringMutationOptions): Promise<ComponentAuthoringResult>;`<br>`patch(entityId: string, componentKey: string, patch: Record<string, unknown>, options?: ComponentAuthoringMutationOptions): Promise<ComponentAuthoringResult>;`<br>`patchField(entityId: string, componentKey: string, value: unknown, options: ComponentFieldAuthoringMutationOptions): Promise<ComponentAuthoringResult>;`<br>`delete(entityId: string, componentKey: string, options?: ComponentAuthoringMutationOptions): Promise<ComponentAuthoringResult>;`<br>`setOverride(entityId: string, componentKey: string, patch: Record<string, unknown>, options?: ComponentAuthoringMutationOptions): Promise<ComponentAuthoringResult>;` |
| `CustomEventHost` | 1 | `emit(eventKey: string, payload?: Record<string, unknown>, targetEntityId?: string): void;` |
| `EntityAuthoringHost` | 8 | `find(name: string): Promise<ProjectEntityDto \| undefined>;`<br>`findByTag(tag: string): Promise<ProjectEntityDto[]>;`<br>`findByComponent(type: string): Promise<ProjectEntityDto[]>;`<br>`duplicate(entityId: string, options?: EntityDuplicateOptions): Promise<ProjectEntityDto[]>;`<br>`setParent(entityId: string, parentId: string \| null, options?: EntitySetParentOptions): Promise<ProjectEntityDto>;`<br>`setSiblingOrder(entityId: string, order: number, options?: AuthoringMutationOptions): Promise<ProjectEntityDto>;`<br>`getChildren(entityId: string): Promise<ProjectEntityDto[]>;`<br>`getDescendants(entityId: string): Promise<ProjectEntityDto[]>;` |
| `FxHost` | 2 | `particleBurst(options: FxParticleBurstOptions): void;`<br>`decal(options: FxDecalOptions): void;` |
| `InstanceAuthoringHost` | 2 | `getPrefab(instanceId: string): Promise<ProjectPrefabDto \| undefined>;`<br>`getOverrides(instanceId: string): Promise<PrefabOverride[]>;` |
| `InventoryHost` | 1 | `grant(playerSessionId: string, itemKey: string, quantity: number, reason?: string): void;` |
| `LogHost` | 5 | `(message: string, metadata?: Record<string, unknown>, level?: LogLevel): void;`<br>`debug(message: string, metadata?: Record<string, unknown>): void;`<br>`info(message: string, metadata?: Record<string, unknown>): void;`<br>`warn(message: string, metadata?: Record<string, unknown>): void;`<br>`error(message: string, metadata?: Record<string, unknown>): void;` |
| `MatchHost` | 5 | `getState(): Record<string, unknown>;`<br>`setPhase(phaseKey: string, reason?: string, metadata?: Record<string, unknown>): void;`<br>`addScore(subjectKey: string, amount: number, scoreboardKey?: string, reason?: string): void;`<br>`getScore(subjectKey: string, scoreboardKey?: string): number;`<br>`patchObjective(objectiveKey: string, patch: Record<string, unknown>, reason?: string): void;` |
| `MaterialAuthoringHost` | 1 | `applySemanticPatch(materialAssetId: ProjectAssetId, patch: MaterialSemanticPatchAuthoringRequest): Promise<MaterialSemanticPatchAuthoringResult>;` |
| `NavigationHost` | 5 | `findPath(worldId: string, from: Vector3, to: Vector3, agentProfileKey?: string): NavigationPathResult;`<br>`nearestPoint(worldId: string, point: Vector3, agentProfileKey?: string): Vector3 \| null;`<br>`isReachable(worldId: string, from: Vector3, to: Vector3, agentProfileKey?: string): boolean;`<br>`raycast(worldId: string, from: Vector3, to: Vector3, agentProfileKey?: string): NavigationRaycastResult;`<br>`steerToward(worldId: string, from: Vector3, to: Vector3, maxStep: number, agentProfileKey?: string): NavigationSteerResult;` |
| `NetworkHost` | 1 | `sendMessage(channel: string, payload?: Record<string, unknown>, playerId?: string): void;` |
| `PhysicsHost` | 5 | `occupancyQuery(worldId: string, cellKey: string): ReadonlyArray<string>;`<br>`raycast(origin: Vector3, direction: Vector3, distance: number, filter?: PhysicsQueryFilter): PhysicsHit \| null;`<br>`shapecast(shape: PhysicsOverlapShape, transform: { position: Vector3; rotation?: Vector3 \| { x: number; y: number; z: number; w: number } }, direction: Vector3, distance: number, filter?: PhysicsQueryFilter): PhysicsHit \| null;`<br>`overlapTest(shape: PhysicsOverlapShape, transform: { position: Vector3; rotation?: Vector3 \| { x: number; y: number; z: number; w: number } }, filter?: PhysicsQueryFilter): string[];`<br>`command(entityId: string, bodyCommand: PhysicsBodyCommand): void;` |
| `PlatformHost` | 4 | `requestPointerLock(): void;`<br>`exitPointerLock(): void;`<br>`requestFullscreen(target?: "document" \| "viewport"): void;`<br>`exitFullscreen(): void;` |
| `PlayersHost` | 6 | `list(): Player[];`<br>`get(playerSessionId: string): Player \| undefined;`<br>`spawnCharacter(playerSessionId: string, options?: PlayerSpawnCharacterOptions): void;`<br>`possess(playerSessionId: string, entityId: string): void;`<br>`release(playerSessionId: string, reason?: string): void;`<br>`eliminate(playerSessionId: string, reason?: string): void;` |
| `PrefabAuthoringHost` | 5 | `create(entityId: string, options?: PrefabCreateOptions): Promise<ProjectPrefabDto>;`<br>`instantiate(prefabId: string, options?: PrefabInstantiateOptions): Promise<ProjectEntityDto[]>;`<br>`applyOverrides(instanceId: string, scope?: PrefabOverrideScope, options?: AuthoringMutationOptions): Promise<unknown>;`<br>`revertOverrides(instanceId: string, scope?: PrefabOverrideScope, options?: AuthoringMutationOptions): Promise<unknown>;`<br>`unpack(instanceId: string, options?: AuthoringMutationOptions): Promise<ProjectEntityDto[]>;` |
| `ProjectAuthoringHost` | 9 | `createFolder(path: string, options?: ProjectCreateFolderOptions): Promise<ProjectResourceFolderDto>;`<br>`moveAsset(assetId: ProjectAssetId, newPath: string, options?: ProjectMoveAssetOptions): Promise<unknown>;`<br>`findAsset(name: string): Promise<ClientProjectAssetResource \| undefined>;`<br>`uploadAsset(file: AuthoringUploadFile, folder: string, options?: ProjectUploadAssetOptions): Promise<ClientProjectAssetResource>;`<br>`applySmartAssetPackage(packageKey: string, options?: SmartAssetPackageApplyOptions): Promise<SmartAssetPackageApplyReceipt>;`<br>`setMultiplayerBlueprint(definition: RuntimeMultiplayerBlueprintDefinitionDto, options?: AuthoringMutationOptions): Promise<unknown>;`<br>`createAssetPackPreviewBatch(request: AssetPackPreviewBatchRequest, options?: AuthoringMutationOptions): Promise<AssetPackPreviewBatchResult>;`<br>`reviewAssetPackPreviewBatch(batchId: string, request: AssetPackPreviewReviewRequest, options?: AuthoringMutationOptions): Promise<AssetPackGenerationBatch>;`<br>`startAssetPackFinalGeneration(batchId: string, options?: AuthoringMutationOptions): Promise<AssetPackGenerationBatch>;` |
| `ProjectAuthoringSdkHost` | 1 | `applySmartAssetPackage(packageKey: string, options?: SmartAssetPackageApplyOptions): Promise<InternalSmartAssetPackageApplyReceipt>;` |
| `RandomHost` | 13 | `(): number;`<br>`range(min: number, max: number, stream?: RandomStream): number;`<br>`int(min: number, max: number, stream?: RandomStream): number;`<br>`bool(p?: number, stream?: RandomStream): boolean;`<br>`sign(stream?: RandomStream): -1 \| 1;`<br>`pick<T>(array: readonly T[], stream?: RandomStream): T \| undefined;`<br>`weightedPick<T>(items: readonly T[], weights: readonly number[], stream?: RandomStream): T \| undefined;`<br>`shuffle<T>(array: readonly T[], stream?: RandomStream): T[];`<br>`unitVector(stream?: RandomStream): Vector3;`<br>`pointInSphere(radius: number, stream?: RandomStream): Vector3;`<br>`pointInCircle(radius: number, stream?: RandomStream): Vector3;`<br>`gaussian(mean?: number, std?: number, stream?: RandomStream): number;`<br>`seeded(seed: string \| number): RandomStream;` |
| `ReferenceAuthoringHost` | 5 | `resolve(ref: EntityRef \| PrefabRef \| ComponentRef \| AssetRef \| WorldRef): Promise<unknown>;`<br>`isValid(ref: EntityRef \| PrefabRef \| ComponentRef \| AssetRef \| WorldRef): Promise<boolean>;`<br>`repair(entityId: string, newTarget: string, options: ReferenceRepairOptions): Promise<ProjectGraphOpDto[]>;`<br>`assign(entityId: string, target: string, options: ReferenceAssignmentOptions): Promise<ProjectGraphOpDto[]>;`<br>`clear(entityId: string, options: ReferenceAssignmentOptions): Promise<ProjectGraphOpDto[]>;` |
| `RoomHost` | 2 | `getState(): Record<string, unknown>;`<br>`getPlayers(): RoomPlayerSnapshot[];` |
| `ScriptAuthoringHost` | 2 | `applySemanticPatch(scriptIdOrKey: string, patch: ScriptSemanticPatchAuthoringRequest): Promise<ScriptSemanticPatchAuthoringResult>;`<br>`applyScenarioHelper(scriptIdOrKey: string, helper: ScriptScenarioAuthoringHelperId, options?: ScriptScenarioAuthoringOptions): Promise<ScriptSemanticPatchAuthoringResult>;` |
| `ScriptFunctionHost` | 0 |  |
| `ScriptVariableHost` | 4 | `get<T = unknown>(variableIdOrName: string): T;`<br>`get<T = unknown>(scriptIdOrKey: string, variableIdOrName: string): T;`<br>`set<T = unknown>(variableIdOrName: string, value: T): void;`<br>`set<T = unknown>(scriptIdOrKey: string, variableIdOrName: string, value: T): void;` |
| `TeamHost` | 1 | `getAssignment(): Record<string, unknown>;` |
| `TerrainHost` | 5 | `heightAt(worldId: string, x: number, z: number): number;`<br>`normalAt(worldId: string, x: number, z: number): Vector3;`<br>`slopeAt(worldId: string, x: number, z: number): number;`<br>`sampleLayerWeights(worldId: string, x: number, z: number): number[];`<br>`raycastDown(worldId: string, x: number, z: number, fromY: number): PhysicsHit \| null;` |
| `TimerHost` | 2 | `after(seconds: number, options: { resumeEvent: string; key?: string; retriggerable?: boolean }): void;`<br>`cancel(key: string): void;` |
| `TweenHost` | 2 | `start(entityId: string, spec: TweenSpec): void;`<br>`cancel(key: string): void;` |
| `UiHost` | 4 | `readonly catalog: UIEngineCatalog;`<br>`openPanel(panelKey: string, payload?: Record<string, unknown>, audience?: PresentationAudience): void;`<br>`closePanel(panelKey: string, audience?: PresentationAudience): void;`<br>`setWidgetValue(panelKey: string, widgetKey: string, value: unknown, audience?: PresentationAudience): void;` |
| `WarehouseHost` | 10 | `get(key: string, recordKey: string): Record<string, unknown> \| undefined;`<br>`create(key: string, recordKey: string, value: Record<string, unknown>): void;`<br>`update(key: string, recordKey: string, patch: Record<string, unknown>): void;`<br>`increment(key: string, recordKey: string, changes: Record<string, number>): void;`<br>`append(key: string, recordKey: string, path: string, value: unknown): void;`<br>`set(key: string, recordKey: string, value: Record<string, unknown>): void;`<br>`transform(key: string, recordKey: string, ops: readonly WarehouseFieldOp[], expect?: WarehouseExpect): void;`<br>`query(key: string, filter?: Record<string, WarehouseQueryFilterValue>, options?: WarehouseQueryOptions): WarehouseQueryResult;`<br>`query(key: string, options?: WarehouseQueryOptions): WarehouseQueryResult;`<br>`delete(key: string, recordKey: string): void;` |
| `WaterHost` | 2 | `surfaceLevelAt(worldId: string, x: number, z: number, atTimeMs?: number): number;`<br>`isSubmerged(worldId: string, point: Vector3): boolean;` |
| `WorldAuthoringHost` | 4 | `load(name: string, options?: AuthoringMutationOptions): Promise<ProjectWorldDto>;`<br>`unload(name: string, options?: AuthoringMutationOptions): Promise<ProjectWorldDto>;`<br>`getActive(): Promise<ProjectWorldDto \| undefined>;`<br>`getLoaded(): Promise<ProjectWorldDto[]>;` |
| `WorldHost` | 10 | `find(filter: WorldFindFilter): RuntimeEntitySnapshot[];`<br>`query(options: WorldQueryOptions): WorldQueryPage;`<br>`spawn(config: RuntimeSpawnConfig \| PrefabSpawnConfig): void;`<br>`spawnMany(configs: (RuntimeSpawnConfig \| PrefabSpawnConfig)[]): void;`<br>`spawnPrefab(prefabKey: string, position?: Vector3): void;`<br>`despawn(entityId: string, options?: RuntimeDespawnOptions): void;`<br>`teleportPlayer(playerId: string, targetWorldKey: string, options?: TeleportPlayerOptions): void;`<br>`setEntityOwner(entityId: string, profileId?: string): void;`<br>`setEntityTag(entityId: string, tag: string): void;`<br>`entityHasTag(entityId: string, tag: string): boolean;` |

## ScriptContext

| Member |
| --- |
| `readonly assets: AssetCatalog;` |
| `readonly components: Record<string, ComponentPayload>;` |
| `readonly componentTypes: EngineComponentCatalog;` |
| `readonly uiTypes: UIEngineCatalog;` |
| `readonly room: RoomHost;` |
| `readonly players: PlayersHost;` |
| `readonly player: Player \| undefined;` |
| `readonly match: MatchHost;` |
| `readonly team: TeamHost;` |
| `readonly commerce: CommerceHost;` |
| `readonly inventory: InventoryHost;` |
| `readonly ui: UiHost;` |
| `readonly warehouse: WarehouseHost;` |
| `readonly audio: AudioHost;` |
| `readonly fx: FxHost;` |
| `readonly physics: PhysicsHost;` |
| `readonly tween: TweenHost;` |
| `readonly navigation: NavigationHost;` |
| `readonly terrain: TerrainHost;` |
| `readonly water: WaterHost;` |
| `readonly world: WorldHost;` |
| `readonly events: CustomEventHost;` |
| `readonly network: NetworkHost;` |
| `readonly platform: PlatformHost;` |
| `readonly camera: CameraHost;` |
| `readonly script: ScriptRuntimeSelf;` |
| `readonly entity: EntityAccessor;` |
| `readonly props: Record<string, unknown>;` |
| `readonly tickedAt: string;` |
| `readonly delta: number;` |
| `readonly trigger: string;` |
| `readonly random: RandomHost;` |
| `readonly debug: LogHost;` |
| `readonly info: LogHost;` |
| `readonly warn: LogHost;` |
| `readonly error: LogHost;` |
| `readonly log: LogHost;` |
| `readonly timer: TimerHost;` |
| `readonly isAuthority: boolean;` |
## AudioHost

| Member |
| --- |
| `play(assetId: ProjectAssetId, options?: AudioPlayOptions): AudioHandle;` |
| `playSpatial(assetId: ProjectAssetId, position: Vector3, options?: AudioPlayOptions): AudioHandle;` |
| `stop(handle: AudioHandle): void;` |
| `setVolume(handle: AudioHandle, volume: number): void;` |
| `setBackgroundMusic(assetId: ProjectAssetId, options?: AudioPlayOptions): AudioHandle;` |
## AuthoringSdkHost

| Member |
| --- |
| `readonly project: ProjectAuthoringSdkHost;` |
| `readonly entity: EntityAuthoringHost;` |
| `readonly component: ComponentAuthoringHost;` |
| `readonly script: ScriptAuthoringHost;` |
| `readonly material: MaterialAuthoringHost;` |
| `readonly prefab: PrefabAuthoringHost;` |
| `readonly instance: InstanceAuthoringHost;` |
| `readonly world: WorldAuthoringHost;` |
| `readonly reference: ReferenceAuthoringHost;` |
## CameraHost

| Member |
| --- |
| `addLookInput(delta: Vector3): void;` |
| `setLookSensitivity(degreesPerUnit: number): void;` |
| `setPitchClamp(minDeg: number, maxDeg: number): void;` |
| `setViewTarget(target: string, offset?: Vector3): void;` |
## CommerceHost

| Member |
| --- |
| `promptPurchase(offerKey: string, audience?: PresentationAudience): void;` |
| `owns(entitlementKey: string, playerSessionId?: string): boolean;` |
## ComponentAuthoringHost

| Member |
| --- |
| `put(entityId: string, componentKey: string, value: Record<string, unknown>, options?: ComponentAuthoringMutationOptions): Promise<ComponentAuthoringResult>;` |
| `patch(entityId: string, componentKey: string, patch: Record<string, unknown>, options?: ComponentAuthoringMutationOptions): Promise<ComponentAuthoringResult>;` |
| `patchField(entityId: string, componentKey: string, value: unknown, options: ComponentFieldAuthoringMutationOptions): Promise<ComponentAuthoringResult>;` |
| `delete(entityId: string, componentKey: string, options?: ComponentAuthoringMutationOptions): Promise<ComponentAuthoringResult>;` |
| `setOverride(entityId: string, componentKey: string, patch: Record<string, unknown>, options?: ComponentAuthoringMutationOptions): Promise<ComponentAuthoringResult>;` |
## CustomEventHost

| Member |
| --- |
| `emit(eventKey: string, payload?: Record<string, unknown>, targetEntityId?: string): void;` |
## EntityAuthoringHost

| Member |
| --- |
| `find(name: string): Promise<ProjectEntityDto \| undefined>;` |
| `findByTag(tag: string): Promise<ProjectEntityDto[]>;` |
| `findByComponent(type: string): Promise<ProjectEntityDto[]>;` |
| `duplicate(entityId: string, options?: EntityDuplicateOptions): Promise<ProjectEntityDto[]>;` |
| `setParent(entityId: string, parentId: string \| null, options?: EntitySetParentOptions): Promise<ProjectEntityDto>;` |
| `setSiblingOrder(entityId: string, order: number, options?: AuthoringMutationOptions): Promise<ProjectEntityDto>;` |
| `getChildren(entityId: string): Promise<ProjectEntityDto[]>;` |
| `getDescendants(entityId: string): Promise<ProjectEntityDto[]>;` |
## EntityHandle

| Member |
| --- |
| `readComponent<T extends BuiltInComponentType>(componentTypeOrKey: T): BuiltInComponentPayload<T> \| undefined;` |
| `readComponent(componentTypeOrKey: ProjectComponentType): Record<string, unknown> \| undefined;` |
| `script(scriptIdOrKey: string): ScriptRuntimeSelf \| undefined;` |
| `addComponent(...args: MutableBuiltInComponentMutationArgs): void;` |
| `addComponent(componentType: ProjectComponentType, data: Record<string, unknown>): void;` |
| `patchComponent(...args: MutableBuiltInComponentMutationArgs): void;` |
| `patchComponent(componentType: ProjectComponentType, patch: Record<string, unknown>): void;` |
| `replaceComponent(...args: MutableBuiltInComponentMutationArgs): void;` |
| `replaceComponent(componentType: ProjectComponentType, data: Record<string, unknown>): void;` |
| `removeComponent<T extends MutableBuiltInComponentType>(componentTypeOrKey: T): void;` |
| `removeComponent(componentTypeOrKey: ProjectComponentType): void;` |
| `setParent(parentId: string, options?: { parentAnchor?: string; siblingOrder?: number; hierarchyFlags?: RuntimeEntitySnapshot["hierarchyFlags"] }): void;` |
| `detach(options?: { keepWorldTransform?: boolean }): void;` |
| `setTag(tag: string): void;` |
| `removeTag(tag: string): void;` |
| `hasTag(tag: string): boolean;` |
| `setName(name: string): void;` |
| `parent(): RuntimeEntitySnapshot \| undefined;` |
| `children(): RuntimeEntitySnapshot[];` |
| `descendants(options?: { maxDepth?: number }): RuntimeEntitySnapshot[];` |
| `ancestors(): RuntimeEntitySnapshot[];` |
| `worldPosition(): Vector3;` |
| `worldRotation(): Vector3;` |
| `owner(): Player \| undefined;` |
| `setOwner(profileId?: string): void;` |
## FxHost

| Member |
| --- |
| `particleBurst(options: FxParticleBurstOptions): void;` |
| `decal(options: FxDecalOptions): void;` |
## InputActionEvent

| Member |
| --- |
| `actionKey: string;` |
| `actorId?: string;` |
| `entityId?: string;` |
| `phase?: "pressed" \| "released" \| "held" \| "sample" \| "cancel";` |
| `valueType?: "boolean" \| "float" \| "vector1d" \| "vector2d" \| "vector3d" \| "quaternion" \| "world_target" \| "screen2d" \| "trigger" \| "composite";` |
| `value?: unknown;` |
| `sourceBindingId?: string;` |
| `inputProfileVersion?: number;` |
| `actionSeq?: number;` |
| `clientSampleTimeMs?: number;` |
| `payload: Record<string, unknown>;` |
## InstanceAuthoringHost

| Member |
| --- |
| `getPrefab(instanceId: string): Promise<ProjectPrefabDto \| undefined>;` |
| `getOverrides(instanceId: string): Promise<PrefabOverride[]>;` |
## InventoryHost

| Member |
| --- |
| `grant(playerSessionId: string, itemKey: string, quantity: number, reason?: string): void;` |
## LogHost

| Member |
| --- |
| `(message: string, metadata?: Record<string, unknown>, level?: LogLevel): void;` |
| `debug(message: string, metadata?: Record<string, unknown>): void;` |
| `info(message: string, metadata?: Record<string, unknown>): void;` |
| `warn(message: string, metadata?: Record<string, unknown>): void;` |
| `error(message: string, metadata?: Record<string, unknown>): void;` |
## MatchHost

| Member |
| --- |
| `getState(): Record<string, unknown>;` |
| `setPhase(phaseKey: string, reason?: string, metadata?: Record<string, unknown>): void;` |
| `addScore(subjectKey: string, amount: number, scoreboardKey?: string, reason?: string): void;` |
| `getScore(subjectKey: string, scoreboardKey?: string): number;` |
| `patchObjective(objectiveKey: string, patch: Record<string, unknown>, reason?: string): void;` |
## MaterialAuthoringHost

| Member |
| --- |
| `applySemanticPatch(materialAssetId: ProjectAssetId, patch: MaterialSemanticPatchAuthoringRequest): Promise<MaterialSemanticPatchAuthoringResult>;` |
## NavigationHost

| Member |
| --- |
| `findPath(worldId: string, from: Vector3, to: Vector3, agentProfileKey?: string): NavigationPathResult;` |
| `nearestPoint(worldId: string, point: Vector3, agentProfileKey?: string): Vector3 \| null;` |
| `isReachable(worldId: string, from: Vector3, to: Vector3, agentProfileKey?: string): boolean;` |
| `raycast(worldId: string, from: Vector3, to: Vector3, agentProfileKey?: string): NavigationRaycastResult;` |
| `steerToward(worldId: string, from: Vector3, to: Vector3, maxStep: number, agentProfileKey?: string): NavigationSteerResult;` |
## NetworkHost

| Member |
| --- |
| `sendMessage(channel: string, payload?: Record<string, unknown>, playerId?: string): void;` |
## PhysicsHost

| Member |
| --- |
| `occupancyQuery(worldId: string, cellKey: string): ReadonlyArray<string>;` |
| `raycast(origin: Vector3, direction: Vector3, distance: number, filter?: PhysicsQueryFilter): PhysicsHit \| null;` |
| `shapecast(shape: PhysicsOverlapShape, transform: { position: Vector3; rotation?: Vector3 \| { x: number; y: number; z: number; w: number } }, direction: Vector3, distance: number, filter?: PhysicsQueryFilter): PhysicsHit \| null;` |
| `overlapTest(shape: PhysicsOverlapShape, transform: { position: Vector3; rotation?: Vector3 \| { x: number; y: number; z: number; w: number } }, filter?: PhysicsQueryFilter): string[];` |
| `command(entityId: string, bodyCommand: PhysicsBodyCommand): void;` |
## PlatformHost

| Member |
| --- |
| `requestPointerLock(): void;` |
| `exitPointerLock(): void;` |
| `requestFullscreen(target?: "document" \| "viewport"): void;` |
| `exitFullscreen(): void;` |
## PlayersHost

| Member |
| --- |
| `list(): Player[];` |
| `get(playerSessionId: string): Player \| undefined;` |
| `spawnCharacter(playerSessionId: string, options?: PlayerSpawnCharacterOptions): void;` |
| `possess(playerSessionId: string, entityId: string): void;` |
| `release(playerSessionId: string, reason?: string): void;` |
| `eliminate(playerSessionId: string, reason?: string): void;` |
## PrefabAuthoringHost

| Member |
| --- |
| `create(entityId: string, options?: PrefabCreateOptions): Promise<ProjectPrefabDto>;` |
| `instantiate(prefabId: string, options?: PrefabInstantiateOptions): Promise<ProjectEntityDto[]>;` |
| `applyOverrides(instanceId: string, scope?: PrefabOverrideScope, options?: AuthoringMutationOptions): Promise<unknown>;` |
| `revertOverrides(instanceId: string, scope?: PrefabOverrideScope, options?: AuthoringMutationOptions): Promise<unknown>;` |
| `unpack(instanceId: string, options?: AuthoringMutationOptions): Promise<ProjectEntityDto[]>;` |
## ProjectAuthoringHost

| Member |
| --- |
| `createFolder(path: string, options?: ProjectCreateFolderOptions): Promise<ProjectResourceFolderDto>;` |
| `moveAsset(assetId: ProjectAssetId, newPath: string, options?: ProjectMoveAssetOptions): Promise<unknown>;` |
| `findAsset(name: string): Promise<ClientProjectAssetResource \| undefined>;` |
| `uploadAsset(file: AuthoringUploadFile, folder: string, options?: ProjectUploadAssetOptions): Promise<ClientProjectAssetResource>;` |
| `applySmartAssetPackage(packageKey: string, options?: SmartAssetPackageApplyOptions): Promise<SmartAssetPackageApplyReceipt>;` |
| `setMultiplayerBlueprint(definition: RuntimeMultiplayerBlueprintDefinitionDto, options?: AuthoringMutationOptions): Promise<unknown>;` |
| `createAssetPackPreviewBatch(request: AssetPackPreviewBatchRequest, options?: AuthoringMutationOptions): Promise<AssetPackPreviewBatchResult>;` |
| `reviewAssetPackPreviewBatch(batchId: string, request: AssetPackPreviewReviewRequest, options?: AuthoringMutationOptions): Promise<AssetPackGenerationBatch>;` |
| `startAssetPackFinalGeneration(batchId: string, options?: AuthoringMutationOptions): Promise<AssetPackGenerationBatch>;` |
## ProjectAuthoringSdkHost

| Member |
| --- |
| `applySmartAssetPackage(packageKey: string, options?: SmartAssetPackageApplyOptions): Promise<InternalSmartAssetPackageApplyReceipt>;` |
## RandomHost

| Member |
| --- |
| `(): number;` |
| `range(min: number, max: number, stream?: RandomStream): number;` |
| `int(min: number, max: number, stream?: RandomStream): number;` |
| `bool(p?: number, stream?: RandomStream): boolean;` |
| `sign(stream?: RandomStream): -1 \| 1;` |
| `pick<T>(array: readonly T[], stream?: RandomStream): T \| undefined;` |
| `weightedPick<T>(items: readonly T[], weights: readonly number[], stream?: RandomStream): T \| undefined;` |
| `shuffle<T>(array: readonly T[], stream?: RandomStream): T[];` |
| `unitVector(stream?: RandomStream): Vector3;` |
| `pointInSphere(radius: number, stream?: RandomStream): Vector3;` |
| `pointInCircle(radius: number, stream?: RandomStream): Vector3;` |
| `gaussian(mean?: number, std?: number, stream?: RandomStream): number;` |
| `seeded(seed: string \| number): RandomStream;` |
## ReferenceAuthoringHost

| Member |
| --- |
| `resolve(ref: EntityRef \| PrefabRef \| ComponentRef \| AssetRef \| WorldRef): Promise<unknown>;` |
| `isValid(ref: EntityRef \| PrefabRef \| ComponentRef \| AssetRef \| WorldRef): Promise<boolean>;` |
| `repair(entityId: string, newTarget: string, options: ReferenceRepairOptions): Promise<ProjectGraphOpDto[]>;` |
| `assign(entityId: string, target: string, options: ReferenceAssignmentOptions): Promise<ProjectGraphOpDto[]>;` |
| `clear(entityId: string, options: ReferenceAssignmentOptions): Promise<ProjectGraphOpDto[]>;` |
## RoomHost

| Member |
| --- |
| `getState(): Record<string, unknown>;` |
| `getPlayers(): RoomPlayerSnapshot[];` |
## RuntimeEntitySnapshot

| Member |
| --- |
| `id: string;` |
| `key: string;` |
| `worldId?: string;` |
| `name?: string;` |
| `parentEntityId?: string \| null;` |
| `parentAnchor?: string \| null;` |
| `siblingOrder?: number \| null;` |
| `hierarchyFlags?: { keepWorldTransformOnDetach?: boolean; inheritReplication?: boolean; cascadeDespawn?: boolean; };` |
| `position?: Vector3;` |
| `tags: string[];` |
| `components?: Record<string, unknown>;` |
| `runtime?: Record<string, unknown>;` |
## ScriptAuthoringHost

| Member |
| --- |
| `applySemanticPatch(scriptIdOrKey: string, patch: ScriptSemanticPatchAuthoringRequest): Promise<ScriptSemanticPatchAuthoringResult>;` |
| `applyScenarioHelper(scriptIdOrKey: string, helper: ScriptScenarioAuthoringHelperId, options?: ScriptScenarioAuthoringOptions): Promise<ScriptSemanticPatchAuthoringResult>;` |
## ScriptFunctionHost

| Member |
| --- |
## ScriptVariableHost

| Member |
| --- |
| `get<T = unknown>(variableIdOrName: string): T;` |
| `get<T = unknown>(scriptIdOrKey: string, variableIdOrName: string): T;` |
| `set<T = unknown>(variableIdOrName: string, value: T): void;` |
| `set<T = unknown>(scriptIdOrKey: string, variableIdOrName: string, value: T): void;` |
## TeamHost

| Member |
| --- |
| `getAssignment(): Record<string, unknown>;` |
## TerrainHost

| Member |
| --- |
| `heightAt(worldId: string, x: number, z: number): number;` |
| `normalAt(worldId: string, x: number, z: number): Vector3;` |
| `slopeAt(worldId: string, x: number, z: number): number;` |
| `sampleLayerWeights(worldId: string, x: number, z: number): number[];` |
| `raycastDown(worldId: string, x: number, z: number, fromY: number): PhysicsHit \| null;` |
## TimerHost

| Member |
| --- |
| `after(seconds: number, options: { resumeEvent: string; key?: string; retriggerable?: boolean }): void;` |
| `cancel(key: string): void;` |
## TweenHost

| Member |
| --- |
| `start(entityId: string, spec: TweenSpec): void;` |
| `cancel(key: string): void;` |
## UiHost

| Member |
| --- |
| `readonly catalog: UIEngineCatalog;` |
| `openPanel(panelKey: string, payload?: Record<string, unknown>, audience?: PresentationAudience): void;` |
| `closePanel(panelKey: string, audience?: PresentationAudience): void;` |
| `setWidgetValue(panelKey: string, widgetKey: string, value: unknown, audience?: PresentationAudience): void;` |
## WarehouseHost

| Member |
| --- |
| `get(key: string, recordKey: string): Record<string, unknown> \| undefined;` |
| `create(key: string, recordKey: string, value: Record<string, unknown>): void;` |
| `update(key: string, recordKey: string, patch: Record<string, unknown>): void;` |
| `increment(key: string, recordKey: string, changes: Record<string, number>): void;` |
| `append(key: string, recordKey: string, path: string, value: unknown): void;` |
| `set(key: string, recordKey: string, value: Record<string, unknown>): void;` |
| `transform(key: string, recordKey: string, ops: readonly WarehouseFieldOp[], expect?: WarehouseExpect): void;` |
| `query(key: string, filter?: Record<string, WarehouseQueryFilterValue>, options?: WarehouseQueryOptions): WarehouseQueryResult;` |
| `query(key: string, options?: WarehouseQueryOptions): WarehouseQueryResult;` |
| `delete(key: string, recordKey: string): void;` |
## WaterHost

| Member |
| --- |
| `surfaceLevelAt(worldId: string, x: number, z: number, atTimeMs?: number): number;` |
| `isSubmerged(worldId: string, point: Vector3): boolean;` |
## WorldAuthoringHost

| Member |
| --- |
| `load(name: string, options?: AuthoringMutationOptions): Promise<ProjectWorldDto>;` |
| `unload(name: string, options?: AuthoringMutationOptions): Promise<ProjectWorldDto>;` |
| `getActive(): Promise<ProjectWorldDto \| undefined>;` |
| `getLoaded(): Promise<ProjectWorldDto[]>;` |
## WorldHost

| Member |
| --- |
| `find(filter: WorldFindFilter): RuntimeEntitySnapshot[];` |
| `query(options: WorldQueryOptions): WorldQueryPage;` |
| `spawn(config: RuntimeSpawnConfig \| PrefabSpawnConfig): void;` |
| `spawnMany(configs: (RuntimeSpawnConfig \| PrefabSpawnConfig)[]): void;` |
| `spawnPrefab(prefabKey: string, position?: Vector3): void;` |
| `despawn(entityId: string, options?: RuntimeDespawnOptions): void;` |
| `teleportPlayer(playerId: string, targetWorldKey: string, options?: TeleportPlayerOptions): void;` |
| `setEntityOwner(entityId: string, profileId?: string): void;` |
| `setEntityTag(entityId: string, tag: string): void;` |
| `entityHasTag(entityId: string, tag: string): boolean;` |
