RTSDK
    Preparing search index...

    Class SceneFactory

    Factory for creating Scene instances. Use this factory to work with scenes in the Topia platform.

    This factory should be instantiated once per application and reused across your codebase. Scenes represent the template or blueprint for a world's design and layout.

    scene, factory, create, template, blueprint, layout, design

    // In your initialization file (e.g., utils/topiaInit.ts)
    import { Topia, SceneFactory } from "@rtsdk/topia";
    const topia = new Topia({ config });
    export const Scene = new SceneFactory(topia);
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    topia: Topia

    Methods

    • Instantiate a new instance of Scene class for an existing scene in the platform.

      Parameters

      Returns Scene

      Returns a new Scene object for interacting with the specified scene.

      This method creates a controller instance for working with a scene but does not fetch its properties. Use this when you need to interact with a specific scene by its id.

      create, instantiate, scene, initialize, instance, template

      // Import the pre-initialized factory from your app's initialization file
      import { Scene } from "utils/topiaInit.ts";

      // Create a Scene instance with credentials
      const sceneInstance = Scene.create(
      "scene-id-123",
      {
      credentials: {
      interactiveNonce,
      interactivePublicKey,
      assetId,
      urlSlug,
      visitorId
      }
      }
      );

      // Fetch scene details if needed
      await sceneInstance.fetchSceneById();
    • Instantiate a new instance of Scene class and retrieve all properties.

      Parameters

      Returns Promise<Scene>

      Returns a new Scene object with all properties.

      const sceneInstance = await Scene.get(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });