Develop
Develop
Select your platform

Mixed Reality Utility Kit – Debug and Test your MRUK app

Updated: Feb 16, 2026

Learning Objectives

  • Enable and configure the Immersive Debugger for MRUK in Editor and Development Builds.
  • Visualize scene data such as meshes, NavMesh and anchors via the SceneDebugger prefab.
  • Interact with scene queries (raycasts, key walls, surface finds) in real time to verify behavior.
  • Integrate the debugger into your build pipeline to test on-device without leaving the headset.
  • Automate spatial testing across multiple room configurations using the MRUK Spatial Testing framework.
  • Analyze test results with the integrated Test Report Viewer.

Scene Debugger Overview

MRUK Scene Debugger
The SceneDebugger is a suite of visualization tools within the Immersive Debugger that lets you inspect MRUK scene data and observe how spatial queries operate live in your app. The SceneDebugger prefab provides a live, in-headset visualization of MRUK scene data such as meshes, NavMesh and anchors. This lets you run spatial queries interactively via the Immersive Debugger menu.

Setup

  1. Enable Immersive Debugger: In Unity, go to Meta → Tools → Immersive Debugger and check Enable.
  2. Development Build: In File → Build Settings, toggle Development Build on for your target platform.
  3. Assign Prefab: In your scene’s MRUK component, set ImmersiveSceneDebuggerPrefab to MetaMRUtilityKit/Core/Tools/ImmersiveSceneDebugger.prefab.

Debugger Menus & Features

  • Toggle visualization of the Scene Mesh.
  • Inspect any baked or runtime NavMesh.
  • Show/hide semantic anchors (walls, floors, volumes).
  • Run individual queries GetKeyWall, GetLargestSurface, IsPositionInRoom, etc.
  • See real-time overlays of hit points, normals, and boundary outlines.
  • Combine toggles and tests to fully validate your placement logic.

On-Device Debugging

With the Immersive Debugger enabled in a Development Build, all debugger menus are accessible in-headset via the system menu. Test without Editor tethering, adjusting settings and running queries directly on the device to validate real-world behavior.

MRUK Spatial Testing

The MRUK Spatial Testing framework provides automated testing capabilities for validating spatial-dependent functionality across multiple room configurations. This framework enables developers to ensure robust behavior of mixed reality features across different physical environments by running tests against various room layouts automatically.

Overview

The MRUK Spatial Testing framework is built on top of Unity’s standard test runner, allowing tests to be easily upgraded to make use of extra scene-specific testing features. Key benefits include:
  • Multi-Room Testing: Automatically run tests across all configured room prefabs or JSON scenes
  • Comprehensive Reporting: Detailed failure analysis with room-specific insights through the integrated Test Report Viewer
  • CI/CD Compatible: Works seamlessly in continuous integration environments
  • Custom Configuration: Support for both project-wide settings and per-test custom configurations
  • Unity Test Runner Integration: Tests are exposed as standard Unity tests and appear in the Test Runner window (Window > General > Test Runner), allowing you to run, debug, and view results using Unity’s familiar testing interface
For a complete working example of MRUK spatial tests, see the Unity-MRUtilityKitSample project on GitHub.

Setting Up a Tests Assembly Folder

Before writing spatial tests, you need to create a Tests assembly folder and configure the required assembly references.
Creating the Tests Folder:
  1. In the Unity Project window, right-click in your desired location
  2. Navigate to Create > Testing > Tests Assembly Folder
  3. Name the folder appropriately, for example Tests
Configuring Assembly References:
After creating the Tests assembly folder, select the generated assembly definition file and add the following Assembly Definition References:
ReferenceDescription
meta.xr.mrutilitykit
Core MRUK functionality
meta.xr.mrutilitykit.tests
MRUK testing framework (contains MRUKTestBase)
Oculus.VR
Oculus VR SDK integration
Note: Ensure Use GUIDs is checked for more reliable reference resolution across project changes.
For more information about Unity’s testing framework, see the Unity Test Framework documentation.

Accessing MRUK Test Settings

To configure the MRUK Spatial Testing framework:
  1. Open Unity’s Project Settings window (Edit > Project Settings)
  2. Navigate to Meta XR > MRUK Tests Settings in the left sidebar

MRUK Tests Settings

The MRUK Tests Settings panel provides comprehensive configuration options for the testing framework.

Test Configuration

SettingDescription
Data Source
Choose between Prefab or Json as the source for room configurations. When set to Prefab, tests use Room Prefabs; when set to Json, tests use Scene JSON files.
Load Scene on Startup
When enabled, automatically loads the configured scene when tests start.
Enable World Lock
Enables world lock functionality during test execution.

Room Configuration

SettingDescription
Room Index
The index of the room to start testing from (0-based).
Seat Width
The default seat width parameter used during testing (in meters).

Test Assets

Configure the room configurations used for testing:
Room Prefabs
  • An array of room prefab GameObjects that will be used when Data Source is set to Prefab
  • Each prefab represents a different room layout for testing
  • Add prefabs using the + button or drag and drop from the Project window
Scene JSON Files
  • An array of TextAsset JSON files that will be used when Data Source is set to Json
  • Each JSON file contains serialized scene data representing a room configuration
  • Useful for testing with real-world captured room data

Test Reporting

SettingDescription
Enable Notifications
When enabled, displays notifications when tests complete.
Auto-open on Failure
When enabled, automatically opens the Test Report Viewer window when test failures occur.
Max Reports to Keep
The maximum number of test reports to retain in history. Older reports are automatically removed.

Actions

Initialize from MRUK Prefab
  • Populates the test settings with default room prefabs and scene JSON files from the MRUK package
  • Useful for quickly setting up a testing environment with built-in room configurations
Open Test Report Window
  • Opens the MRUK Test Report Viewer window to view test results

Writing Spatial Tests

Creating a Basic Test

To create a spatial test, extend the MRUKTestBase class and use the RunTestOnAllScenes method:
using System.Collections;
using Meta.XR.MRUtilityKit;
using Meta.XR.MRUtilityKit.Tests;
using NUnit.Framework;
using UnityEngine.TestTools;

namespace MyProject.Tests
{
    public class MySpatialTests : MRUKTestBase
    {
        [UnityTest]
        [Timeout(DefaultTimeoutMs)]
        public IEnumerator TestRoomHasWalls()
        {
            yield return RunTestOnAllScenes(ExecuteWallTest);
        }

        private IEnumerator ExecuteWallTest(MRUKRoom room)
        {
            // Get all wall anchors in the room
            var walls = room.Anchors.FindAll(x =>
                x.HasAnyLabel(MRUKAnchor.SceneLabels.WALL_FACE));

            // Verify the room has walls
            Assert.IsTrue(walls.Count > 0,
                $"Room {room.name} should have at least one wall");

            yield return null;
        }
    }
}

Using Setup and Teardown Callbacks

The MRUKTestBase class provides lifecycle hooks for per-room setup and teardown:
public class MyTestWithSetup : MRUKTestBase
{
    private GameObject _testObject;

    public override IEnumerator SetUp()
    {
        yield return base.SetUp();

        // Per-room setup callback
        RoomSetUp = (roomName, room) =>
        {
            _testObject = new GameObject("TestObject");
        };

        // Per-room teardown callback
        RoomTearDown = (roomName, room) =>
        {
            if (_testObject != null)
            {
                Object.DestroyImmediate(_testObject);
            }
        };
    }

    public override IEnumerator TearDown()
    {
        // Final cleanup
        yield return base.TearDown();
    }

    [UnityTest]
    public IEnumerator TestWithObject()
    {
        yield return RunTestOnAllScenes(ExecuteTest);
    }

    private IEnumerator ExecuteTest(MRUKRoom room)
    {
        Assert.IsNotNull(_testObject, "Test object should exist");
        yield return null;
    }
}

Using Custom Test Settings

For tests that require specific configurations, you can create custom settings on-the-fly:
[UnityTest]
[Timeout(DefaultTimeoutMs)]
public IEnumerator TestWithCustomRooms()
{
    // Create temporary custom settings (no asset file created)
    var customSettings = ScriptableObject.CreateInstance<MRUKTestsSettings>();

    // Configure settings for this specific test
    customSettings.SceneSettings.RoomIndex = 0;
    customSettings.SceneSettings.SeatWidth = 0.7f;
    customSettings.SceneSettings.LoadSceneOnStartup = true;
    customSettings.SceneSettings.DataSource = MRUK.SceneDataSource.Prefab;

    // Specify custom room prefabs for this test
    customSettings.SceneSettings.RoomPrefabs = new[]
    {
        AssetDatabase.LoadAssetAtPath<GameObject>(
            "Packages/com.meta.xr.mrutilitykit/Core/Rooms/Prefabs/Bedroom/Bedroom00.prefab"),
        AssetDatabase.LoadAssetAtPath<GameObject>(
            "Packages/com.meta.xr.mrutilitykit/Core/Rooms/Prefabs/LivingRoom/LivingRoom01.prefab")
    };

    // Run the test with custom settings - this re-initializes MRUK
    yield return RunTestOnAllScenes(ExecuteMyTest, customSettings);

    // Cleanup the temporary settings instance
    Object.DestroyImmediate(customSettings);
}

Test Report Viewer

The MRUK Test Report Viewer provides a comprehensive interface for viewing and analyzing test results.

Opening the Test Report Viewer

Open the Test Report Viewer using one of these methods:
  • From the MRUK Tests Settings panel, click Open Test Report Window
  • From the menu bar: Window > Meta > MRUK Test Report Viewer

View Modes

The Test Report Viewer supports two viewing modes, accessible via the View Mode dropdown:
By Room View
The By Room view groups test results by room configuration:
  • Rooms Panel (left): Lists all rooms with their pass/fail statistics. Shows the number of passed tests vs total tests for each room. Displays success rate percentage. Click a room to view its detailed results.
  • Room Details Panel (right): Shows detailed information for the selected room, including Room Summary (total test executions, passed count, failed count, and success rate), Test Results by Type (lists each test method with its pass/fail history), and Recent Failures (shows the most recent failure details including timestamp and error message).
By Report View
The By Report view shows test results chronologically:
  • Test Reports Panel (left): Lists all test reports with their success rates. Reports are sorted by most recent first and show overall pass rate for each test execution.
  • Report Details Panel (right): Shows comprehensive details for the selected report, including Test Summary (test method name, timestamp, total tests, passed/failed counts) and Per-Room Statistics (breakdown of results for each room configuration).
  • Search: Use the search field to filter results by test name, room name, or timestamp
  • Show Only Failures: Toggle this checkbox to display only failed tests

Exporting Reports

Click the Export to File button to export the current report data to a text file for external analysis or sharing with team members.

Clearing Reports

Click the Clear Reports button to remove all stored test reports and start fresh.

Best Practices

Test Design

  1. Keep tests focused: Each test method should verify a single aspect of functionality
  2. Use descriptive assertions: Include room-specific context in assertion messages
  3. Handle async operations: Use yield return for operations that need time to complete
private IEnumerator TestSpawnPositions(MRUKRoom room)
{
    spawner.StartSpawn();

    // Wait for spawning to complete
    yield return new WaitForSeconds(1f);

    Assert.AreEqual(expectedCount, spawner.SpawnedObjects.Count,
        $"Expected {expectedCount} objects in room {room.name}");
}

Room Configuration Best Practices

  1. Test diverse configurations: Include rooms with different sizes, shapes, and furniture layouts
  2. Use embedded defaults: The framework provides built-in room configurations for quick setup
  3. Include edge cases: Test rooms with minimal furniture, unusual shapes, or specific features

Result Analysis

  1. Review per-room failures: Use the By Room view to identify which room configurations cause failures
  2. Track success rates over time: Monitor test stability across multiple runs
  3. Export reports for CI/CD: Use the export functionality to integrate with build pipelines

Next:MRUK Samples
Explore more MRUK documentation topics to dive deeper into spatial queries, content placement, manipulation, sharing, and debugging.
Core Concepts
  • Overview Get an overview of MRUK’s key areas and features.
  • Getting Started Set up your project, install MRUK, and understand space setup with available Building Blocks.
  • Place Content without Scene Use Environment Raycasting to place 3D objects into physical space with minimal setup.
  • Manage Scene Data Work with MRUKRoom, EffectMesh, anchors, and semantic labels to reflect room structure.
Content & Interaction
Multiuser
MRUK Samples & Tutorials
Mixed Reality Design Principles
Did you find this page helpful?