简体中文 | English

中文

This article will guide you through the creation of the first VR application using the DPVRUnity SDK.

Unity version: Unity 5.3.0 or later

DPVR Unity plugin version: DpvrUnity0.7.6b or later: Click here to download

Develop for E3? Please also install the latest DPVRAssistant.


1. Create a new Unity project


2. Import DpvrUnity0.7.6a.unitypackage

The DpvrUnity plugin is based on unity5.3.0. If you are later version, Unity will prompt you to upgrade API when importing the plugin.


Please select "I Made a Backup. Go Ahead!".

If the upgrade window does not pop up automatically, please close the project and reopen it.


3. Unity settings

a) Follow Unity setting guidance and complete the project setting

b) Find the Game Tab and add an Aspect Label (1024 x 1024). The aspect ratio of a single eye is 1:1

c) According to your DPVR device type, select the appropriate platform and Switch Platform.

For all-in-one (eg. P1/P1 Pro, P2/P2 Lite), please select "Android".

For the E series (eg. E3), please select "PC, Mac & Linux Standalone".



4. Create a scene

a) Create a folder named "Example" under "Assets" folder

b) Create a scene named "ExampleScene" inside "Example" folder

c) Open "ExampleScene"


5. Replace the Main Camera with DpnCameraRig prefab

a) Locate DpnCameraRig (Assets/DPN/Prefabs/DpnCameraRig) and drag it into the scene.

b) Delete the Main Camera

An empty VR scene is completed so far.


6. Create a 3D Object

a) Create a cube and set its properties.

b) Create a Sphere and set its properties.



7. Create a UI

a) Create a Canvas and set the properties. (Render Mode must be set to World Space).

b) Replace EventSystem with DpnEventSystem.

When creating a Canvas, Unity will create an EventSystem by default.

Unity's default EventSystem can only handle events such as mouse and touch screen, it need to be modified to support VR devices such as HMD and controllers.

The UI interaction is taken place at the position of the ReticlePointer instead of the touch point of a touchpad, or the location of the mouse.

Find the DpnEventSystem prefab(Assets/DPN/Prefabs/DpnEventSystem) and drag it into the scene.

And delete the EventSystem.

c) Create a Button object under Canvas and set its properties.

d) Create a DropDown object under Canvas and set its properties


8. After completing the above steps, the scene is as shown below




9. Debug run in editor mode

a) Click the Play button

When previewing in the editor mode, hold down the Alt key, move the mouse around with the right mouse button pressed in Editor window to look around.

If your device is E-series (eg. E3), and is plugged to the PC with the DPVRAssistant installed. You can simply look around by turning the HMD.

Play the scene and you will see that when the reticlepoint intersects with the UI, its shape changes from a point to a circle. Left-clicking the mouse triggers a UI click event.

When the reticlepoint intersects with the 3D object, its shape changes from a point to a circle.

Whether the reticlepoint will become a circle depends on whether the interacting object has an IPointerEnterHandler.

For example, adding the component EventTrigger to the Cube will become a circle when the cursor interacts with the Cube.


Whether the reticlepoint will interact with the 3D object depends on whether the object has a collision component.


10. Build and run on VR device

Click "Build And Run", make sure the appropriate platform is selected according to 3.c.


At this point, you have completed your very first VR application.


Copyright © dpvr.cn, All Rights Reserved 沪ICP备15019466号-2 (Shanghai) Shanghai Lexiang Technology Co., Ltd