How to Setup Playback
What are we going to learn
How to set up our Playback system so that you can iterate in the editor rather than building to device. Playback will run our algorithms in the editor using recordings.
Prerequisites
You will need a Unity project with Lightship AR enabled and an AR scene configured. For more information, see Installing ARDK 3.
Steps:
Download or create a playback recording
- Sample recordings are available for download here and/or here
- To make your own recording, see How to Create Datasets for Playback.
In Unity Under XR settings ensure that Lightship is selected on the PC platform
-
Open the Project Settings menu (Edit > Project Settings)
-
Select XR Plug-in Management
-
Switch to the PC tab (on the far left)
-
Enable the Lightship SDK checkbox
Enable Playback
- Open the Lightship SDK settings menu (either via Edit > Project Settings > XR Plug-in Management > Lightship SDK, or via Lightship > Settings to open it in the Inspector window)
- Under the Playback header, with the Editor tab selected, check the Enabled box
- Click the button to the right of the Dataset Path field to browse to the location of your Playback dataset. This can be located anywhere in your file system when using Playback in the Unity Editor. However, if you want to run Playback in a build, the files must be located inside your project’s StreamingAssets folder.
Playback is now configured
Press play and the footage should start in Editor. Your scene will need to have added the ARSession and XROrigin from the XR menu to work.
Play through frames manually
If you find your recording moves through the environment too quickly (maybe you want to keep a point of interest on screen for longer), you can click the “Run Manually” checkbox to enable controls the next time you start Playback.
Run Manually mode controls:
- Spacebar: step forward one frame
- Hold left arrow: scroll backward
- Hold right arrow: scroll forward
Get Playback GPS data
Wherever you would use the UnityEngine.Input
API normally, instead use Lightship’s implementation by adding using Input = Niantic.Lightship.AR.Input;
to the top of your C# file. Lightship’s implementation has the exact same API as Unity’s; and when not running in Playback mode, it is a simple passthrough to Unity’s APIs. When in Playback mode, it’ll supply the location data from the active dataset.