I used Unity and made a VR application in 2 days

It is O of the Sapporo office.

In response to the quirky request of the president, I tried creating a VR application with Unity.

First of all, what is VR? ... An abbreviation for virtual reality, which is the virtual reality (Reality) which has attracted attention for a long time.

While saying that attention has been paid, a large-scale headset is necessary, it was not quite common.

However, Google announced what Google CardBard is, and it became familiar at once.


CardBoard is cardboard in Japan, Cardboard VR.

If seen it is obvious, it is made of corrugated cardboard.


The front is the one assembled, the back is the package before assembly.

I will see a stereoscopic image through a lens with a smartphone in between.

It is a built-in gyroscope sensor that detects where you are looking up and down, right and left, and reflects the direction.


Well, the following is the procedure until display to make VR game this time.

Title "Create VR game with Unity"

1. Investigate how VR expression will be possible

By importing SDK for Unity, you can use VR cameras etc capable of split screen display.

· Dive Unity Plugin package (this time we used this)


· Cardboard SDK for Unity


2. How to create game screens etc.

It is possible to create it in the same way as with conventional 3D game creation.

There is no particular difficulty if you are a Unity experienced person.

The creation of the game itself is done as usual, and the VR game can be done just by replacing the camera.

3. On how to express VR

It is possible to replace the existing camera with the camera added to the project by import.

① appearance before camera replacement

Image 1

② Replace existing camera and Dive_Camera

Specifically, Main_Camera which is originally in Scene is deleted, and Dive_Camera is added to Hierarchy.

Image 2

③ GameView after replacing the camera

Running in the development environment, the boring angle moves in response to the position of the mouse pointer in the editor. This corresponds to a form that responds to the gyro in the case of actual equipment (installed with a terminal attached to cardboard VR).

Image 3

According to Dive Unity Plugin package, there was something like Dive_Camera's default to respond to gyro sensor, but somehow built in my environment does not react, create script and apply it to Dive_Camera We resolve it by doing. I think that it is a native relationship, but I am not digging deeply.

Hereinafter, actual correspondence contents

Image 4

By attaching the script which described this to Dive_Camera, the camera angle was updated even on the actual machine.

4. About the input with the smartphone set in the VR device

It is the most unknown part!

Examining it, it seems necessary to have a detection method suitable for the VR device with different switches etc attached.

In this time, we used a conventional touch judgment as the VR device that was at hand had a structure that made conductive cloth part touch the screen by pushing the switch.

Even in the VR who tried the same cardboard, there were also types that slide the magnet.
This seems to be regarded as input by checking the value with the magnetic sensor on the terminal side before and after sliding the magnet.




5. Completion play!

It is a screen which is completed and is playing. Actually it looks two-dimensional, not three-dimensional.

play 1 play 2

play 3 play 4

If you are Android, you can download the apk file from the following URL and play it.


Although it was my first attempt, I could implement it smoothly without any particular clogging.

Although I spent time investigating, I think whether it is possible to create a simple VR application without taking one day if it is a person who can handle Unity.

Please do try it by all means.