Banter JavaScript SDK: Scene, Objects, and Components

The Banter JavaScript SDK is the runtime API for creating interactive 3D VR spaces with JavaScript. Its official reference covers scene management, objects, components, events, physics, rendering, audio, media, VR interaction, UI, math types, and multiplayer state.

Understand the Runtime First

Wait for Banter to initialize, get the scene singleton, then create GameObjects and add only the components each object needs.

  1. Wait for the Banter SDK's bs-loaded event.
  2. Get the BanterScene singleton and wait for its unity-loaded event.
  3. Create a GameObject, set its transform, and add visual, physics, or interaction components.

Core Concepts

BanterScene

BanterScene is the top-level singleton. The official reference uses it to manage GameObjects, components, connected users, browser communication, settings, events, shared state, and utility methods.

GameObject

A GameObject is a container in the scene. It has a Transform and can hold components. Use GameObjects to give named scene elements a position, rotation, scale, hierarchy, and behaviour.

Components

Components add specific capabilities to a GameObject. Banter's reference groups them by task:

  • physics and colliders
  • joints
  • rendering, materials, text, lights, and mirrors
  • geometry primitives
  • audio
  • GLTF, asset bundles, video, browsers, portals, and other media
  • grabbing and held-object interaction
  • synchronization and other special behaviours
  • UI panels and controls

Transform

Every GameObject has a Transform for position, rotation, and scale. The API supports local and world-space changes and provides vector and quaternion types for spatial values.

Runtime Initialization

Do not call the Banter API before it is ready. The official quick start waits for two stages:

  1. The window emits bs-loaded, making the BS API available.
  2. The scene emits unity-loaded, indicating that the Unity side of the scene is ready.

Build object-creation code inside that ready flow. This avoids scripts trying to access the SDK or scene before initialization has completed.

Pick Components by Task

Goal Official API area to open
Add a visible primitive Geometry Primitives and BanterMaterial
Add collisions or movement Physics Components
Make an object grabbable VR Interaction Components
Load a model or video Media & Content Components
Build in-world controls UI System
React to users or input Scene Events and GameObject Events
Share state between users User & Multiplayer

Use the complete Banter JavaScript SDK reference for current constructor options, properties, methods, events, enums, and examples.

Multiplayer State

The official API separates persistent/shared state from one-shot messages. BanterScene exposes public space properties, protected space properties, user properties, and one-shot messages, along with events for reacting to changes.

Choose the state mechanism that matches the behaviour you are building, then test it with more than one connected user. A locally working interaction does not by itself prove that state or ownership behaves correctly across a multiplayer session.

Common Questions

Why is BS unavailable when my script starts?

Wait for the window's bs-loaded event before using the Banter SDK. The official quick start then waits for the scene's unity-loaded event before creating scene objects.

Should every GameObject get every component?

No. Add the components required for that object's visual, physics, audio, media, UI, synchronization, or interaction role.

Where can I find every supported property and event?

Use Banter's complete JavaScript SDK reference. This page explains the structure, while the official reference remains the source of truth for the current API surface.

Official References

Related Navigation