• Guides
    • English
    • 日本語
  • API Documentation
  • 機能概要
  • Multi Scene System
  • Content Scene Loading

    Show / Hide Table of Contents
    • MRTK を始める
      • Release Notes
      • MRTK Package Contents
      • Updating from earlier versions
      • HTK からの移植ガイド
      • MRTK のビルドとデプロイ
      • NuGet Packages
      • Getting started with MRTK and XR SDK
      • Performance
      • Hologram Stabilization (ホログラムの安定化)
    • アーキテクチャ
      • 全体像
      • フレームワークとランタイム
      • Input System (入力システム)
        • 用語
        • Core System
        • Controllers, Pointers, and Focus
      • Systems, Extension Services and Data Providers
    • 機能概要
      • Boundary System
        • Boundary System Overview
        • Configuring the Boundary Visualization
      • Camera System
        • Camera System Overview
        • Camera Settings Providers
          • Windows Mixed Reality Camera Settings
          • Unity AR Camera Settings [Experimental]
          • Creating a camera settings provider
      • Cross Platform Support
        • Configure MRTK for iOS and Android
      • プラットフォームの Capabilities (機能) を検出する
      • Diagnostics System (診断システム)
        • 診断システムの概要
        • 診断システムの構成
        • ビジュアル プロファイラーを使用する
      • Extension Services
        • Extension Service Creation Wizard
        • Scene Transition Service Overview
        • Hand Physics Service Overview
      • Input System (入力システム)
        • 入力の概要
        • Input Actions
        • Input Events
        • Input Providers
          • Input Providers Overview
          • Creating an input data provider
        • Controllers (コントローラー)
        • Eyes
        • Gaze (ゲイズ)
        • Gestures (ジェスチャ)
        • Hands
        • How to Add Near Interaction
        • エディター内入力シミュレーション
        • Pointers
        • Voice Input
          • Dictation (ディクテーション)
          • Speech (コマンドとコントロール)
      • Multi Scene System
        • Multi Scene System Overview
        • Scene Types
        • Content Scene Loading
        • Monitoring Content Loading
        • Lighting Scene Operations
      • パッケージ
        • MRTK パッケージ
        • MRTK Modularization
      • Profiles (プロファイル)
        • プロファイル概要
        • 設定ガイド
      • Rendering
        • Material Instance Overview
        • Shaders
          • MRTK Standard Shader
      • Services (サービス)
        • What makes a mixed reality feature
        • MixedRealityServiceRegistry と IMixedRealityServiceRegistrar とは何か
        • Extension services
      • Spatial Awareness System (空間認識システム)
        • Spatial Awareness (空間認識) 概要
        • Spatial Observers
          • Configuring Observers for Device
          • Configuring Observers for Editor
          • Controlling Observers via Code
          • Creating a custom Observer
      • Teleport System (テレポートシステム) 概要
      • ツール
        • Dependency Window (依存関係ウィンドウ)
        • Extension Service Creation Wizard
        • Holographic Remoting
        • Input Animation Recording
          • Input Animation File Format Specification
        • Optimize Window
        • Runtime tools
          • Controller Mapping tool
      • UX ビルディング ブロック
        • Interactable (インタラクタブル)
        • Button (ボタン)
        • Bounding Box
        • Object Manipulation (物体操作)
        • Sliders (スライダー)
        • Fingertip Visualization
        • App Bar
        • Object Collection (オブジェクトコレクション)
        • Slate (スレート)
        • System Keyboard (システム キーボード)
        • Tooltips (ツールチップ)
        • Solvers (ソルバー)
      • Example Scenes
        • Examples Hub
        • ハンド インタラクションのサンプル
        • アイ トラッキング インタラクションのサンプル
      • Experimental
        • Scrolling Object Collection
        • Hand Coach UX
        • Pulse Shader
    • Contributing
      • Contributing Overview
      • Coding Guidelines
      • Writing and Running Tests
      • Writing Documentation
      • Pull Requests
      • Experimental Features
      • Breaking Changes
      • How to use DocFX
    • Planning
      • Roadmap
    • Notice
    • Authors

    Content scene loading

    All content load operations are asynchronous, and by default all content loading is additive. Manager and lighting scenes are never affected by content loading operations. For information about monitoring load progress and scene activation, see Monitoring Content Loading.

    Loading content

    To load content scenes use the LoadContent method:

    IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService<IMixedRealitySceneSystem>();
    
    // Additively load a single content scene
    await sceneSystem.LoadContent("MyContentScene");
    
    // Additively load a set of content scenes
    await sceneSystem.LoadContent(new string[] { "MyContentScene1", "MyContentScene2", "MyContentScene3" });
    

    Single scene loading

    The equivalent of a single scene load can be achieved via the optional mode argument. LoadSceneMode.Single will first unload all loaded content scenes before proceeding with the load.

    IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService<IMixedRealitySceneSystem>();
    
    // ContentScene1, ContentScene2 and ContentScene3 will be loaded additively
    await sceneSystem.LoadContent("ContentScene1");
    await sceneSystem.LoadContent("ContentScene2");
    await sceneSystem.LoadContent("ContentScene3");
    
    // ContentScene1, ContentScene2 and ContentScene3 will be unloaded
    // SingleContentScene will be loaded additively
    await sceneSystem.LoadContent("SingleContentScene", LoadSceneMode.Single);
    

    Next / previous scene loading

    Content can be singly loaded in order of build index. This is useful for showcase applications that take users through a set of demonstration scenes one-by-one.

    MRTK_SceneSystemBuildSettings

    Note that next / prev content loading uses LoadSceneMode.Single by default to ensure that the previous content is unloaded.

    IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService<IMixedRealitySceneSystem>();
    
    if (nextSceneRequested && sceneSystem.NextContentExists)
    {
        await sceneSystem.LoadNextContent();
    }
    
    if (prevSceneRequested && sceneSystem.PrevContentExists)
    {
        await sceneSystem.LoadPrevContent();
    }
    

    PrevContentExists will return true if there is at least one content scene that has a lower build index than the lowest build index currently loaded. NextContentExists will return true if there is at least one content scene that has a higher build index than the highest build index currently loaded.

    If the wrap argument is true, content will loop back to the first / last build index. This removes the need to check for next / previous content:

    IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService<IMixedRealitySceneSystem>();
    
    if (nextSceneRequested)
    {
        await sceneSystem.LoadNextContent(true);
    }
    
    if (prevSceneRequested)
    {
        await sceneSystem.LoadPrevContent(true);
    }
    

    Loading by tag

    MRTK_SceneSystemLoadingByTag

    It's sometimes desirable to load content scenes in groups. Eg, a stage of an experience may be composed of multiple scenes, all of which must be loaded simultaneously to function. To facilitate this, you can tag your scenes and then load them or unload them with that tag.

    IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService<IMixedRealitySceneSystem>();
    
    await LoadContentByTag("Stage1");
    
    // Wait until stage 1 is complete
    
    await UnloadContentByTag("Stage1");
    await LoadContentByTag("Stage2);
    

    Loading by tag can also be useful if artists want to incorporate / remove elements from an experience without having to modify scripts. For instance, running this script with the following two sets of tags produces different results:

    IMixedRealitySceneSystem sceneSystem = MixedRealityToolkit.Instance.GetService<IMixedRealitySceneSystem>();
    
    await LoadContentByTag("Terrain");
    await LoadContentByTag("Structures");
    await LoadContentByTag("Vegetation");
    

    Testing content

    Scene Name Scene Tag Loaded by script
    DebugTerrainPhysics Terrain •
    StructureTesting Structures •
    VegetationTools Vegetation •
    Mountain Terrain •
    Cabin Structures •
    Trees Vegetation •

    Final content

    Scene Name Scene Tag Loaded by script
    DebugTerrainPhysics DoNotInclude
    StructureTesting DoNotInclude
    VegetationTools DoNotInclude
    Mountain Terrain •
    Cabin Structures •
    Trees Vegetation •

    Editor behavior

    You can perform all these operations in editor and in play mode by using the Scene System's service inspector. In edit mode scene loads will be instantaneous, while in play mode you can observe loading progress and use activation tokens.

    MRTK_SceneSystemServiceInspector

    • Improve this Doc
    In This Article
    • Loading content
    • Single scene loading
    • Next / previous scene loading
    • Loading by tag
      • Testing content
      • Final content
    • Editor behavior
    Back to top Generated by DocFX