Daydream in Unreal

After following the Get Started guide, building a Daydream app takes a few more steps. This page describes some steps unique to Daydream development.

In order to build and run a Daydream application, you must have a Daydream-ready phone and Daydream hardware.


Make sure CodeWorks has installed the following components:

  • Android API 24
  • Android NDK 12b
  • JDK 1.8

This guide assumes you have completed the steps in Get Started.

Add the Daydream controller

To use the Daydream controller in your application, go to Edit > Plugins and enable the Google VR Motion Controller plugin. Next, add a Motion Controller Component to your project. The input on the Daydream controller is mapped to the Motion Controller inputs as follows:

GVR Controller Input UE4 Input
Home Button Not Mapped(Reserved for System)
App Button FGamepadKeyNames::MotionController_[Left/Right]_Shoulder
Touch Position X FGamepadKeyNames::MotionController_[Left/Right]_Thumbstick_X
Touch Position Y FGamepadKeyNames::MotionController_[Left/Right]_Thumbstick_Y
Touch Pad Touch Steam_Touch_0
Touch Pad Click(Center) FGamepadKeyNames::MotionController_[Left/Right]_Thumbstick
Touch Pad Click(Left) FGamepadKeyNames::MotionController_[Left/Right]_FaceButton4
Touch Pad Click(Right) FGamepadKeyNames::MotionController_[Left/Right]_FaceButton2
Touch Pad Click(Up) FGamepadKeyNames::MotionController_[Left/Right]_FaceButton1
Touch Pad Click(Down) FGamepadKeyNames::MotionController_[Left/Right]_FaceButton3

Left or right is determined by the Hand set in the Motion Controller.

Daydream users can set their preferred controller handedness, which persists across all Daydream apps. You can get the preference through the Blueprint function GetGoogleVRControllerHandedness.

The Google VR SDK also includes a Google VR motion controller component.

You can use the Controller Emulator to interact with your application directly in Unreal Editor's Play Mode.

You can toggle the controller emulator with the following console commands:


Google VR Project Packaging & Deployment

Configure the GoogleVR deployment mode

There are three Depolyment Modes for GoogleVR on Android. You can set th deployment mode under Edit > Project Settings > Platform > Android.

Daydream: The application will support only Daydream-ready devices. It can use the Daydream controllers and VR optimizations such as asynchronous reprojection.

Cardboard: The application can run on most mobile devices, with a Cardboard viewer, but cannot use the Daydream controllers or VR optimizations.

Daydream & Cardboard The application will use Daydream features on Daydream-ready devices, and function as a Cardboard application on other devices.

Additional project settings

Go to Edit > Project Settings > Platform > Android SDK. Under SDKConfig, make sure the locations of Android SDK, Android NDK, ANT, and Java are set to the correct versions installed by CodeWorks. Set NDK API Level to android-24 and SDK API Level to matchndk.

Go to Edit > Project Settings > Platform > Android. Under the APKPackaging section, set the following options:

  • Set the Target SDK Version to 24.
  • Enable Enable FullScreen Immersive.
  • Enable Configure for deployment to Daydream.
  • Select your VR app icon under the Daydream App Tile section.

Setup a Daydream splash screen for your application

Daydream applications require a splash screen to be published to the Play Store. The Google VR Plugin provides a few simple ways to set a splash screen.

Set the splash texture path in your project's DefaultEngine.ini file:

TextureUVOffset=(X=0.0, Y=0.0)
TextureUVSize=(X=1.0, Y=1.0)

Set or change the splash texture through Blueprint functions:


Performance tips for Daydream application

Rendering resolution

Use r.MobileContentScaleFactor to render at a lower resolution. Android will use the Hardware Scaler to performantly scale to full screen.

Set the render target size through the Blueprint functions in GoogleVRHMDFunctionLibrary. You can set the size as a scaler or absolute resolution. We recommend using the scale factor to always get the correct aspect ratio for a render target regardless of the phone or viewer. When GVRHMDRenderTargetScaleFactor is set to 1, it will set the Google VR render target size to the max effective resolution based on your current surface size, which will be larger than the surface size.

This is the pipeline on a phone with a 1920 x 1080 screen resolution and default settings (r.MobileContentScaleFactor = 1.0, GVRHMDRenderTargetScale = 1.0):

  1. Render scene with GVRHMD RenderTargetSize (1644x972).
  2. Async reprojection distorts the render target to the surface size (1280 x 720).
  3. The Hardware Scaler scales the surface to the screen's full resolution (1920 x 1080).

Enable MSAA

If you are rendering at a lower resolution to improve performance, MSAA can help reduce any aliasing. Unreal Engine currents support 2x MSAA for Daydream applictions. You can enable MSAA by setting r.MobileOnChipMSAA = 1 in the device profile.

Sustained Performance Mode

Daydream applications can use Sustained Performance Mode. In this mode, the hardware runs at a reduced performance level but avoids performance drops due to overheating. It is intended for long-running applications (over an hour). You can set this flag under Edit > Project Settings > Platform > Android.