Skip to main content

Function: registerEnvironment()

function registerEnvironment(world: World, options?: IWSDKEnvironmentOptions): IWSDKEnvironmentSetup;

Defined in: packages/iwsdk-environment/src/index.ts:90

One call to wire the environment (and optionally the audio) into an IWSDK world, and register the system that ticks them.

const env = registerEnvironment(world, {
presets: STOCK_PRESETS,
initial: VOID,
audio: { cues: [{ id: "hum", src: "/audio/hum.mp3", bus: "ambience", loop: true }] },
});
env.environment.transition("dusk", { durationMs: 8000 });

Passthrough is NOT read from the session here - push it in from whatever already tracks capabilities (env.environment.setPassthrough(...)). The session belongs to the platform layer, not to the environment.

Parameters

ParameterType
worldWorld
optionsIWSDKEnvironmentOptions

Returns

IWSDKEnvironmentSetup