The Simulation system in Unity MARS reduces testing time for augmented reality (AR) app development. It provides world-understanding capabilities, like plane and image marker detection, right in the Unity Editor — in both Play and Edit Mode. Read on to learn more about this system and how creators can use it to rapidly iterate on context-adaptable AR experiences.
Unity MARS makes it easy to create complex AR experiences that intelligently adapt to the real world. We designed this authoring tool to address the three most common pain points for AR developers: authoring for an enormous possibility space of data, iterating and testing against real-world scenarios, and delivering apps that adapt responsively to their environment.
Simulation solves the problem of iteration time by enabling AR testing within the Unity Editor to preview how an AR device would work with its physical surroundings. Simulation facilitates testing against a variety of environments that imitate or come from the real world. This makes it easier to create apps and experiences that are adaptable and accessible. In combination with the proxy and condition-matching systems of Unity MARS, Simulation helps empower creators to push the boundaries of spatial computing.
As a system, Simulation can be broken down into two core functionalities that are conceptually separate, but work together to drastically reduce iteration time:
Preview the execution of a scene in isolation in Edit Mode. Set up an environment scene in the Editor, and provide AR data based on that environment.
We’ll go into detail on how these parts of Simulation work to improve AR development.
How execution previewing works
Simulation lets you preview the execution of a scene in Edit Mode to support rapid iteration and provide an instantaneous understanding of how flexible proxies that represent real-world objects might behave in the real world. In the execution preview process, Simulation copies the GameObjects in the active scene into a preview scene – called the content scene – and sets the runInEditMode flag on each MonoBehaviour in the content scene that opts into running. See the Unity MARS documentation for details on how to write MonoBehaviours that are compatible with Simulation scene preview.
With the Simulation view, you can interact with this scene execution preview in isolation from your open Unity scenes. The Simulation view is a custom Scene view that shows the content scene rendered over the environment scene (the next section digs more into the environment scene), from either a third-person perspective or from the camera’s perspective.
In Unity MARS, the default behavior of a Simulation preview is to run in instant mode. In this mode, the entire execution process happens over a single frame, in which Unity MARS tries to match proxies against all data at once. While this behavior is not realistic, it has the benefit of providing immediate feedback as you define proxies and their conditions.
You can also manually start and stop a continuous mode Simulation preview. This mode is more analogous to Play Mode, in that the behaviors in the content scene run frame by frame until the preview is stopped. App interaction and behavior in continuous preview are limited, since some Unity systems, like physics and input, only work in Play Mode. Continuous preview is useful for seeing how your app responds to data that changes over timeContinue reading