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):
Ensure that you have the Mesh toolkit imported.
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.
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:
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.
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:
- In the Hierarchy, select MeshEmulatorSetup [NoUpload].
- In the Inspector, navigate to the Mesh Emulator Setup script.
- In the Teleport Player on Play section, enter the Position and Rotation XYZ values you want the player to teleport to.
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:
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:
-or-
Start Play Mode.
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.