Skip to content

Latest commit

 

History

History
77 lines (48 loc) · 5.8 KB

File metadata and controls

77 lines (48 loc) · 5.8 KB
title description ms.service author ms.author ms.date ms.topic keywords
Play Mode with Mesh Emulation testing in Unity
Test your Mesh environment using Play Mode with Mesh Emulation in Unity.
mesh
vtieto
vinnietieto
6/27/2024
Guide
Microsoft Mesh, testing, troubleshooting, Mesh emulator, emulator, troubleshooting, debugging, Mesh Emulation Mode, emulation

Play Mode with Mesh Emulation testing in Unity

If you add the Mesh Emulator prefab (or, simply, the "Emulator") to your Unity project, you gain the ability to run the project in Play Mode with Mesh Emulation. In this scenario, when you press the Unity editor Play button, you get an approximate preview of what the content will look and feel like when it runs in the Mesh app. This greatly speeds up the iteration cycle during content development and allows developers of advanced interactive content to deeply debug the logic with all the powerful tools that Unity offers.

The look and feel of Play Mode with Mesh Emulation is similar but not identical to the look and feel in the Mesh app. We're continuously working to reduce the differences where possible without sacrificing the lightweight environment necessary for quick iteration. A key feature of Play Mode with Mesh Emulation is the ability to run multiple clients within the same process; this allows a single developer to easily get a first impression of a multi-user scenario.

To use Play Mode with Mesh Emulation in your project (or not):

  1. Ensure that you have the Mesh toolkit imported.

  2. Ensure that the scene contains a piece of solid floor below the origin that's set to the GroundCollision layer. Set the floor's XYZ Position values to 0, 0, 0.

  3. Press the Play button. The toolkit checks to see if a GameObject with "EmulatorSetup" in its name exists at the top level of the Hierarchy. If it doesn't, this dialog appears:

    A screenshot of the Mesh Emulator Setup missing dialog.

    Do one of the following:

    To ensure that Mesh Emulation runs every time you click Play:

    • Select the first button, Add working MeshEmulatorSetup prefab. The MeshEmulatorSetup [NoUpload] prefab appears in the Hierarchy.

    A screenshot of the Mesh Emulator Setup No Upload prefab added to the Hierarchy.

    To avoid running Mesh Emulation and prevent the "Emulator Setup missing" dialog from appearing again when you click Play:

    • Select the second button, Add dummy NoMeshEmulatorSetup game object. As the name suggests, this doesn't actually do anything, but the toolkit will find "EmulatorSetup" in its name and will refrain from showing you the Emulator Setup missing dialog again.

If you initially decide you don't want to use Mesh Emulation Mode, but change your mind later on, delete the NoMeshEmulatorSetup [NoUpload] GameObject from the Hierarchy. The next time you click Play, the toolkit will display the Emulator Setup missing dialog again, and you can click the button to add the Emulator.

Teleport Player on Play

When working in a large scene, you may find it valuable to teleport the player to a specific location at startup. To achieve this:

  1. In the Hierarchy, select MeshEmulatorSetup [NoUpload].
  2. In the Inspector, navigate to the Mesh Emulator Setup script.
  3. In the Teleport Player on Play section, enter the Position and Rotation XYZ values you want the player to teleport to.

A screenshot of the Mesh Emulator Setup component with the Teleport Player on Play section highlighted.

Mesh Emulation Split Screen

This feature lets you run multiple clients within the same process and show them side-by-side within the same window. Mesh toolkit itself implements a very minimal emulated network component that's sufficient to communicate the player position between the clients, allowing the different players to see each other as heavily stylized avatars:

A screenshot of multiple clients displayed side-by-side in Mesh Emulation Mode.

This is sufficient for previewing static content. When developing interactive content, visual scripting, cloud scripting and/or WebSlate, keep in mind that those features each contain their own networking mechanisms which provide a Mesh Emulation preview of a synchronized experience with multiple users.

Do one of the following:

  • Increase the initial screen count before entering Play mode by setting the value in the Mesh Emulator Setup component:

A screenshot of the Mesh Emulator Setup component with the Initial Screen Count property set to two.

-or-

  1. Start Play Mode.

  2. In the DontDestroyOnLoad scene, navigate to the EmulatorSplitScreen component and then select Add screen.

    ___

Now you can quickly test your Unity Scene without going through the build and upload process each time you make an iteration.

Important

If you're using the Visual Profiler in your scene, make sure the Initial Screen Count setting in the Mesh Emulator Setup component is zero. If it's "1" or higher, you won't see the Visual Profiler.

A screen shot of the Mesh Emulator Setup component with Initial Screen Count set to zero.