# Instant Preview

Use Instant Preview to test VR apps that you are building in Unreal
Engine instantly on your phone. Instant Preview lets you skip the build process
and improve iteration time.

## Overview

Instant Preview is compatible with:

- Unreal Engine version 4.15 or later

Instant Preview consists of an Android app for your [Daydream-ready phone](https://vr.google.com/daydream/smartphonevr/phones/)
and a plugin for Unity or Unreal Engine.

In Instant Preview, you can:

- Preview your app's **full VR experience** in the editor **or use just the
  physical Daydream controller** in the editor
- **Configure streaming** to optimize for resolution or for latency

### Developer considerations

- Rendering happens on your development machine, meaning that Instant Preview is not suitable for performance testing or for calling Android APIs directly.

## Use Instant Preview

The Instant Preview plugin and Android app are bundled with the Google VR Unreal
branch.

This guide assumes that you have already created a Google VR project in
Unreal Engine. If you are new to using the Google VR SDK in Unreal Engine, see
the [Google VR Unreal Quickstart guide](https://developers.google.com/vr/develop/unreal/get-started).

### Get started

1. Install the Instant Preview app from the command line:

   ```
   adb install -r UnrealGithub/Engine/Source/ThirdParty/GoogleInstantPreview/InstantPreview.apk
   ```
2. Launch Instant Preview.

3. Connect your phone to your computer via USB.

4. Launch the Unreal Editor and open your Google VR project. The
   Instant Preview app indicates that it is ready to stream.

5. In the Unreal Editor, start your project in **VR Preview** mode.

   ![](https://developers.google.com/static/vr/images/tools/unreal-settings.png)
6. To change the resolution, select advanced settings in the **Play** dropdown
   menu, and adjust the play-in-editor window resolution.

   ![](https://developers.google.com/static/vr/images/tools/unreal-resolution-settings.png)
7. (Optional)See the following section for details on switching [preview modes](https://developers.google.com/vr/develop/unreal/instant-preview#switch_preview_modes).

### Switch preview modes

In Instant Preview, you can opt to stream your app's full VR experience or
controller interactions only.

| Mode | Description | Use for |
|---|---|---|
| **Full VR preview** | - Changes you make in the editor are visible immediately on your phone in VR. - Instant Preview streams head pose and controller data to your development machine, where the game engine renders the scene in stereo and streams video back to your phone. - Provides an instant preview of your app with low enough latency to make longer usage sessions comfortable | Longer usage sessions iterating on multiple aspects of your app. |
| **Controller only** | - Streams only controller data to the editor. - No stereo preview shown on the phone. | Iterating only on controller interactions |

To switch preview modes:

1. If your app is running, click **Pause** in the Unreal Editor.
2. In the Instant Preview app on your phone, use the **Preview via...** dropdown to select **Full VR preview** or **Controller only** mode.
3. Click **Play** in the Unreal Editor to begin streaming.

### Troubleshooting

Make sure that:

- Your phone is connected to your computer via USB

- Your phone is unlocked and [developer options](https://developer.android.com/studio/debug/dev-options.html)
  are enabled

- You completed the [Instant Preview setup steps](https://developers.google.com/vr/develop/unreal/instant-preview#get_started) in this guide.

- The `ANDROID_HOME` environmental variable is set to the
  Android SDK Path (for example, `%LocalAppData%\Android\sdk\`)

- The Google VR Plugin is enabled in your project

- Check that the `.dll` and `.dylib` files under:

  `Engine\Binaries\ThirdParty\GoogleInstantPreview\<your_platform>\Release\`

  are the same as those in:

  `Engine\Source\ThirdParty\GoogleInstantPreview\<your_platform>\Release\`