Loading multiple Unity scenes in a single Immerse App


For various reasons, it's better to split up scenes into smaller sections:

  • easier to work concurrently in a team of developers
  • multiple "levels" or "rooms" which require content to be delivered on demand

How to implement

Additive scenes are supported by Unity out of the box and the Immerse Platform and SDK don't require extra work from a development perspective. That said, it's worth pointing out a few details when using them:

App and Scene objects

The Immerse SDK requires core App and Scene objects to function on the platform (see Setting up an Immerse Scene for details). This is still the case with additive scenes and the same rules apply. Only one App and Scene object is permitted, so it is recommended that a "main" scene is created, containing these objects and other additive scenes contain the the rest of the geometry and objects. Keep the main scene loaded, and load/unload the other scenes as required.

Build list

To load a scene, the Unity Editor requires them to be included in the Build List.

Duplicate indices

Interactive objects are likely to be distributed across various additive scenes, which in turn will generate duplicate indices. It is recommended that all scenes in the Build List are kept open at the same time (Unity Editor supports Multi-scene editing . Set the first (main) scene in the Build List as the active scene. If this is done, scene indices will be checked and calculated correctly. All scenes in the Build List can be opened from the Unity Editor menu Immerse > Build > Open Scenes.

Loading scenes

Scenes can be loaded in the Unity Editor by using the SceneManager class - ensure they are loaded loaded additively otherwise core objects required by the Immerse SDK might be lost. The Immerse SDK includes a component called LoadSceneAdditively that will loads scenes additively at start-up.

Slightly longer load times

Be aware that the app's startup time might be slightly longer now. It is important that all scenes are loaded and that the immerse SDK is ready, before platform services are accessed. Also see Waiting for the SDK in the programming guide.

Updated 9 months ago

Loading multiple Unity scenes in a single Immerse App

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.