releases/2.5.4mrtk_developmentreleases/2.0.0releases/2.1.0releases/2.2.0releases/2.4.0releases/2.5.0releases/2.5.1releases/2.5.2releases/2.5.3
  • Guides
  • API Documentation

We've moved!

Starting from MRTK 2.6, we are publishing both conceptual docs and API references on docs.microsoft.com. For conceptual docs, please visit our new landing page. For API references, please visit the MRTK-Unity section of the dot net API explorer. Existing content will remain here but will not be updated further.

  • Guides
  • Feature Overviews
  • Example Scenes
  • Examples Hub

    Show / Hide Table of Contents
    • Getting Started with MRTK
      • Release Notes
      • MRTK Package Contents
      • Updating from earlier versions
      • Upgrading from HTK
      • Building and Deploying MRTK
      • NuGet Packages
      • Getting started with MRTK and XR SDK
      • Performance
      • Hologram Stabilization
    • Architecture
      • Overview
      • Framework and Runtime
      • Input System
        • Terminology
        • Core System
        • Controllers, Pointers, and Focus
      • Systems, Extension Services and Data Providers
    • Feature Overviews
      • 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
      • Detecting Platform Capabilities
      • Diagnostics System
        • Diagnostics System Overview
        • Configuring the Diagnostics System
        • Using the Visual Profiler
      • Extension Services
        • Extension Service Creation Wizard
        • Scene Transition Service Overview
        • Hand Physics Service Overview
      • Input System
        • Input Overview
        • Input Actions
        • Input Events
        • Input Providers
          • Input Providers Overview
          • Creating an input data provider
        • Controllers
        • Eyes
        • Gaze
        • Gestures
        • Hands
        • How to Add Near Interaction
        • In-Editor Input Simulation
        • Pointers
        • Voice Input
          • Dictation
          • Speech (Command and Control)
      • Multi Scene System
        • Multi Scene System Overview
        • Scene Types
        • Content Scene Loading
        • Monitoring Content Loading
        • Lighting Scene Operations
      • Packaging
        • MRTK Packages
        • MRTK Modularization
      • Profiles
        • Profiles Overview
        • Configuration Guide
      • Rendering
        • Material Instance Overview
        • Shaders
          • MRTK Standard Shader
      • Services
        • What makes a mixed reality feature
        • What are the MixedRealityServiceRegistry and IMixedRealityServiceRegistrar
        • Extension services
      • Spatial Awareness System
        • Spatial Awareness Overview
        • Spatial Observers
          • Configuring Observers for Device
          • Configuring Observers for Editor
          • Controlling Observers via Code
          • Creating a custom Observer
      • Teleport System Overview
      • Tools
        • Dependency Window
        • Extension Service Creation Wizard
        • Holographic Remoting
        • Input Animation Recording
          • Input Animation File Format Specification
        • Optimize Window
        • Runtime tools
          • Controller Mapping tool
      • UX Building Blocks
        • Interactable
        • Button
        • Bounding Box
        • Object Manipulation
        • Sliders
        • Fingertip Visualization
        • App Bar
        • Object Collection
        • Slate
        • System Keyboard
        • Tooltips
        • Solvers
      • Example Scenes
        • Examples Hub
        • Hand Interaction Example
        • Eye Tracking Interaction Example
      • 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

    MRTK Examples Hub

    MRTK Examples Hub

    MRTK Examples Hub is a Unity scene that makes it easy to experience multiple scenes. It uses MRTK's Scene System to load & unload the scenes.

    MRTKExamplesHub.unity is the container scene that has shared components including MixedRealityToolkit and MixedRealityPlayspace. MRTKExamplesHubMainMenu.unity scene has the cube buttons.

    Prerequisite

    MRTK Examples Hub uses Scene Transition Service and related scripts. If you are using MRTK through Unity packages, please import Microsoft.MixedReality.Toolkit.Unity.Extensions.x.x.x.unitypackage which is part of the release packages. If you are using MRTK through the repository clone, you should already have MixedRealityToolkit.Extensions folder in your project.

    MRTKExamplesHub scene and the scene system

    Open MRTKExamplesHub.unity which is located at MixedRealityToolkit.Examples/Experimental/Demos/ExamplesHub/Scenes/ It is an empty scene with MixedRealityToolkit, MixedRealityPlayspace and LoadHubOnStartup. This scene is configured to use MRTK's Scene System. Click MixedRealitySceneSystem under MixedRealityToolkit. It will display the Scene System's information in the Inspector panel.





    On the bottom of the Inspector, it displays the list of the scenes defined in the Scene System Profile. You can click the scene names to load/unload them.





    Example of loading MRTKExamplesHub scene by clicking the scene name in the list.

    Example of loading HandInteractionExamples scene.

    Example of loading multiple scenes.

    Running the scene

    The scene works in both Unity's game mode and on device. Run the MRTKExamplesHub scene in the Unity editor and use MRTK's input simulation to interact with the scene contents. To build and deploy, simply build MRTKExamplesHub scene with other scenes that are included in the Scene System's list. The inspector also makes it easy to add scenes to the Build Settings. In the Building Settings, make sure MRTKExamplesHub scene is on the top of the list at index 0.

    How MRTKExamplesHub loads a scene

    In the MRTKExamplesHub scene, you can find the ExamplesHubButton prefab. There is a FrontPlate object in the prefab which contains Interactable. Using the Interactable's OnClick() and OnTouch() event, it triggers the LoadContentScene script's LoadContent() function. In the LoadContentScene script's Inspector, you can define the scene name to load.







    The script uses the Scene System's LoadContent() function to load the scene. Please refer to the Scene System page for more details.

    MixedRealityToolkit.SceneSystem.LoadContent(contentName, loadSceneMode);
    

    Returning to the main menu scene

    To return to the main menu scene (MRTKExamplesHubMainMenu scene), you can use the same Scene System LoadContent() method. The ToggleFeaturesPanelExamplesHub.prefab provides the 'Home' button which contains the LoadContentScene script. Use this prefab or provide a custom home button in each scene to allow the user to return to the main scene. One can put the ToggleFeaturesPanelExamplesHub.prefab in the MRTKExamplesHub scene to make it always visible since MRTKExamplesHub is a shared container scene. Make sure to hide/deactivate ToggleFeaturesPanel.prefab in each example scene.

    Adding additional buttons

    In the CubeCollection object, duplicate (or add) ExampleHubButton prefabs and click Update Collection in the GridObjectCollection. This will update the cylinder layout based on the new total number of buttons. Please refer to the Object Collection page for more details.





    After adding the buttons, update the scene name in the LoadContentScene script(explained above). Add additional scenes to the Scene System's profile.

    • Improve this Doc
    In This Article
    • Prerequisite
    • MRTKExamplesHub scene and the scene system
    • Running the scene
    • How MRTKExamplesHub loads a scene
    • Returning to the main menu scene
    • Adding additional buttons
    Back to top Generated by DocFX