Vuforia Play Mode in Unity

Vuforia Play Mode is fully integrated in Unity and it is the quickest way to test your projects during development right at your PC or Mac. Use the Webcam or Simulator play Mode that is distributed with the Vuforia Engine SDK for Unity to fast-track your development process.

Unity’s Play Mode supports all target types from Vuforia, and it is controlled by using Unity’s Play, Pause, and Step buttons. We present two Play Modes which enables you to quickly test your build and targets.

Vuforia Play Modes

  • Webcam
  • Simulator

The two modes can be found in the Vuforia Configuration. From a dropdown menu you can select between them. To enable Vuforia Engine in Unity, please refer to this guide.

Webcam Play Mode

The Webcam Play Mode uses a webcam to simulate tracking of Vuforia targets at your desk. It requires you to use your in-built Webcam in your laptop or connect one via USB (External Camera) to your PC. The Vuforia Engine will automatically detect if a Webcam is available that can be chosen from the dropdown menu Camera Device if you have multiple connected.

Testing Targets Types with WEBCAM

Webcam play mode supports all Vuforia target types except Area Targets which is supported only in Simulator Mode. Once in play mode, the webcam will simulate detection and tracking of your target. Test your target and your content as you would if you had built the Unity Project to your device.

Note that device tracking is not as good on a webcam as it would be on your device given that your webcam does not come with any sensors.

Vuforia Ground Plane emulation

To test Vuforia Ground Plane with a Webcam, it is necessary to use an Image Target as the ground. A webcam cannot detect and track the ground on its own, so we will instead emulate the ground with an Image Target. If you are using the Vuforia Core Samples, the EmulatorGroundPlane.pdf can be found in  Packages\VuforiaEngineAR\Vuforia\Databases\ForPrint\Emulator or in Packages\com.ptc.vuforia.engine\Vuforia\Database\ForPrint\Emulator

For more information, please refer to Introduction to Ground Plane in Unity.

Simulator Play Mode

This Play Mode is purely simulating tracking and detection of your Vuforia targets. When enabled, the simulator mode will create a virtual space that you can move the ARCamera around in and the feature is especially intended for testing Area Targets. That being said, you can use other target types independently or simultaneously in the simulator mode if you, for instance, do not have your target nearby or it is too large to test with a webcam.  

Go to Vuforia Configuration and set the Play mode type to SIMULATOR. The simulator mode allows you to adjust the virtual walking speed as well as detection distance for simulated tracking and the key bindings for moving around. (See below Image).

Testing Target Types with SIMULATOR

To test one or more of your Vuforia Targets in your build simply add the Vuforia Engine GameObjects in your scene and set them up with the appropriate targets or databases. Upon pressing Play you will be able to navigate within the space starting at the origin of the ARCamera GameObject.

Target detection in simulation mode

Simulator mode is helpful for positioning and testing your content in relation to scanned areas and other target types. 
Starting with Vuforia Engine 9.1, targets will be reported as tracked as soon as they come into the virtual camera view and closer than the detection distance defined in the Vuforia Configuration.
If the Device Tracker is started, they will be reported as extended tracked as soon as they leave the camera view.
This allows rapid prototyping of your application’s scripts if they react to targets being detected or out of view, even if you do not have access to the physical targets.

NOTE: That this simulated detection does not actually use computer vision and therefore does not replace testing the actual detection and tracking quality of your real targets on mobile devices.

Recording Play Mode

Unity's Editor Play Mode can also be used with video recordings from the Session Recorder API. It is a convenient addition to help you continuing authoring with your Vuforia Targets even when the target is not available or in vicinity to you. Using a recording in Play Mode requires a video recording made with the Session Recorder API. See Recordings and Playback for more information on creating recordings.

Set up a Vuforia enabled scene with the ARCamera GameObject, and a Vuforia target that was captured in the recording you previously created. 

  1. In the Vuforia Configuration, set the Play Mode type to – RECORDING. 
  2. Browse to the directory of your recording(s) and select one of the session folders.
  3. Change or add content to your Vuforia target and press Play. This will play back the video recording of your Vuforia target and present content according to your scene build.

The work can then continue with exchanging content on the Vuforia target and test it in the recorded sessions and scenarios. We encourage you to integrate this feature into your development process and use recordings to adjust your AR app to specific scenarios, environments, Vuforia targets, and even lighting settings, and use the versatile possibilities that a recording can offer.