DirectPreview

Introduction

In the development process, repeatedly building APKs in Unity is time-consuming. Direct Preview lets developers skip the build process. Developers can preview in both Unity Editor and their HMD device simultaneously.

Note

The rendering path for Android applications differs substantially from the rendering path used for game previews, and you may notice important differences in the look-and-feel and performance.

Architecture

_images/Architecture_unity.png

Direct Preview is separated into three parts:

  • rrServer

rrServer takes over the Unity textures and the poses sent from wvr_plugins_directpreview.dll. And then, rrServer encodes these information and sends them to wvr_plugins_directpreview_agent_unity.apk.

  • wvr_plugins_directpreview_agent_unity.apk

wvr_plugins_directpreview_agent_unity.apk sends the information like pose, event and state of the HMD and the controllers to wvr_plugins_directpreview.dll. wvr_plugins_directpreview_agent_unity.apk also takes over the images sent from rrServer, decodes the images, and displays the images in the HMD.

  • wvr_plugins_directpreview.dll

wvr_plugins_directpreview.dll takes over both the information (pose, event and state of device) sent from wvr_plugins_directpreview_agent_unity.apk and the image textures sent from Unity Editor. Information of devices and textures are packaged and sent to rrServer.

Steps

  1. WaveVR > DirectPreview > Enable Direct Preview

Check the menu item “Enable Direct Preview” in Unity Editor.

_images/step1.png
  1. WaveVR > DirectPreview > Direct Preview Options

Check the menu item “Direct Preview Options” in Unity Editor.

  • Connect Type
_images/step2_connect_usb.png
  • Select USB

    Get device information (pose, event, state) through USB. Instant preview can be seen in Unity Editor, but not in HMD.

_images/step2_connect_wifi.png
  • Select Wi-Fi

    • Device Wi-Fi IP

      Fill in the HMD’s Wi-Fi IP in the dialog window.

    • Enable preview image

      • Check “Enable preview image”:

        Enable to present the corresponding effect according to the pose, event and state returned from the HMD,and enable to show the Unity Game mode images in both Unity Game mode and HMD.

      • Uncheck “Enable preview image”:

        Enable to present the corresponding effect according to the pose, event and state returned from the HMD,and only display in the Unity Game mode.

  • Update frequency

    Developers can choose how many images will be sent to the HMD in one second in different network environments. There are six options: Runtime defined, 15 FPS, 30 FPS, 45 FPS, 60 FPS, 75 FPS. If “Runtime defined” is selected, it will set the value automatically according to the default value in HMD. If the default value doesn’t exist, or the default value is abnormal, it set the value to 75 FPS.

    Note

    FPS here means how many images rrServer send to the APK, instead of the FPS shown in Unity Editor.

  • Preview image ratio

    Developers can choose the image size shown in HMD. There are five ratio options: 1, 0.8, 0.6, 0.4, 0.2.

  • Regularly save images

    Check “Regularly save images” will regularly get two-eyes images from Unity, and save them ( dp_unity_image0_number.jpg and dp_unity_image1_number.jpg ) in the path D:/ .

  1. WaveVR > DirectPreview > Install Device APK

Install wvr_plugins_directpreview_agent_unity.apk to the HMD. Click on “Install Device APK”, it will automatically install the APK to the HMD and create a “config.json” in the path “/sdcard/DirectPreview” in the HMD.

_images/step3.png
  1. WaveVR > DirectPreview > Start Streaming Server

Click on “Start Streaming Server” to start rrServer.

_images/step4.png _images/step52.png
  1. WaveVR > DirectPreview > Start Device APK

Start wvr_plugins_directpreview_agent_unity.apk in the HMD.

_images/step6.png
  1. After rrServer is connected with wvr_plugins_directpreview_agent_unity.apk, click on the “Play” button in Unity Editor to preview instantly.
  2. WaveVR > DirectPreview > Stop Device APK

Stop running the APK in the HMD.

_images/step7.png
  1. WaveVR > DirectPreview > Stop Streaming Server

Stop rrServer.

_images/step8.png

Note

Before close the Unity Editor, please make sure “Play mode” is turned off in Unity.