Creating New Worlds

Overview

Samsung Gear VR is Samsung’s first virtual reality device that was developed in collaboration with Oculus. The wearable provides immersive and enchanting experiences to the users. All you need is to snap compatible smartphones like the Galaxy Note 5 and the Galaxy S6 or S6 Edge into the Gear VR.

Developing applications for Gear VR is very exciting especially to developers who have not yet experienced virtual reality technology.

Figure 1 the Hello World 360 App

Figure 1 the Hello World 360 App

Setting up the Environment

Below are the software requirements for Gear VR development in Unity. It is recommended that the exact versions mentioned below should be downloaded and installed.

  • Unity 5.3.2f1

  • Java SE Development Kit 8 (JDK)

  • Android SDK 5.0 and SDK Tools

  • Created Unity Project integrated with the following:

    • Sample assets

  • Oculus Signature File

You will need one of the following hardware combinations:

  • Samsung Gear VR with Samsung GALAXY Note 5, S6, S6 Edge or S6 Edge+

  • Samsung Gear VR Innovator Edition for Note 4 with Samsung GALAXY Note 4 or

  • Samsung Gear VR Innovator Edition for S6 with Samsung GALAXY S6 or S6 Edge

Now that your environment is set up, you may begin development in Unity. Below is a step by step tutorial on how to develop the Hello World 360 App.

Step 1. Open the Unity Project

a. Launch Unity and click the Open button.

b. In the Open Existing Project dialog, navigate to the location of HelloWorld360 project and select the folder.

Figure 2 Opening a Project in Unity

Figure 2 Opening a Project in Unity

Step 2. Update Build Settings

a. From the menu, select File > Build Settings…

b. In the Build Settings window, change the Platform to Android and the Texture Compression to ETC2 (GLES 3.0).

c. Click the Switch Platform button and close the window.

Figure 3 Updating the Build Settings

Figure 3 Updating the Build Settings

Step 3. Create the Main Scene

a. From the menu, select File > Save Scene.

b. In the Save Scene dialog, name the file Main.unity and save it to the /Assets/Workshop/Scenes folder in your Unity project.

c. In the Hierarchy view, select the Main Camera object. You will see the object selected in the Scene view and its details displayed in the Inspector view.

Figure 4 Scene and Hierarchy View

Figure 4 Scene and Hierarchy View

d. In the Inspector view, navigate to the Transform component and make sure the following values are set:

  • Position: (0, 0, 0)

  • Rotation: (0, 0, 0)

Figure 5 Transform Component

Figure 5 Transform Component

Step 4. Add Cube Mesh to Scene

a. In the Project view, open the /Assets/Workshop/Meshes folder and drag the Box_Inv object into the Hierarchy view. You can also drag the object into the Scene view, but dragging it into the Hierarchy view will position the object at (0, 0, 0).

Figure 6 3D Inverted Cube Mesh

Figure 6 3D Inverted Cube Mesh

Step 5. Apply Materials to Object

a. With the Box_Inv object selected, navigate to the Inspector view and locate the Mesh Renderer component. Expand the Materials section. Here you will see a Size property and several Elements slots. The Size property dictates the number of Element slots. In this case, there are six, one for each side of the inverted box object. Changing the materials in the Element slots will change the background image for the Main scene.

Figure 7 Materials Section

Figure 7 Materials Section

b. In the Project view, open the /Assets/Workshop/Materials folder. Here you will see six different Box materials with a number appended. These numbers correspond to the Box_Inv object's Element slots in the Mesh Renderer > Materials setting. Drag the Box_0_Back.mat file into the Element 0 property field.

Figure 8 Applying materials to Box_Inv object

Figure 8 Applying materials to Box_Inv object

c. Repeat step b for the five remaining Element slots.

Figure 9 Applying materials to Box_Inv object

Figure 9 Applying materials to Box_Inv object

Step 6. Add Prefab Scene

a. In the Project view, open the /Assets/Workshop/Prefabs folder and drag the Logo_1 prefab into the Hierarchy view.

Figure 10 Adding a Prefab to the Scene

Figure 10 Adding a Prefab to the Scene

b. In the Inspector view, navigate to the Transform component and make sure the following values are set:

  • Position: (0, 0, 30)

  • Rotation: (-90, -180, 0)

Note

In addition to using the Inspector view, you can also position an object in the Scene view by dragging the object by one of its axes.

Figure 11 Transform Component

Figure 11 Transform Component

c. From the menu, select Window > Lighting.

d. In the Lighting view, select the Scene tab and navigate to the Environment Lighting section.

e. To the right of the Skybox field, click the Target button. In the Select Material window, choose the Skybox material.

Figure 12 Environment Lighting

Figure 12 Environment Lighting

f. Save the scene and review the Main scene in Scene view.

Figure 13 the Main Scene in Scene View

Figure 13 the Main Scene in Scene View

Step 7. Edit the Player Settings

a. From the menu, select Edit > Project Settings > Player.

b. In the Inspector view, review the current PlayerSettings.

c. Change the following settings:

  • Company Name: Add your company here

  • Product Name: Hello World 360

  • Default Icon: Icon (/Assets/Workshop/Textures/Icon.png)

Figure 14 Player Settings

Figure 14 Player Settings

d. Expand the Other Settings section and change the following settings:

  • Virtual Reality Supported: Enabled

  • Bundle Identifier: com.[yourCompanyName].HelloWorld360

Figure 15 Other Settings

Figure 15 Other Settings

Step 8. Generate and Use Oculus Signature File

a. Navigate to https://developer.oculus.com/tools/osig/ . Login to your Oculus account. If you don’t have an account, create one now.

b. In the Device ID field, type in your Device ID and click the Download File button. Your oculus will be downloaded to your machine. Be sure to keep this file in a location that is easily accessible.

c. In Assets directory, add the following path: \Plugins\Android\assets

d. In the \Plugins\Android\assets folder, add your device OSIG file.

Step 9. Build and Run the Application

a. Connect your device to your machine via USB.

b. Make sure USB debugging has been enabled in your device.

c. Return to Unity. From the menu, select File > Build Settings…

d. Click the Add Open Scenes button to add your Main scene to the Scenes In Build list.

e. Under the Android settings, make sure the Text Compression is set to ETC2 (GLES 3.0).

f. Click the Build and Run button.

g. In the Build Windows dialog, give your APK file a name and click Save.

h. Once Unity has finished building your app, you will see the Insert device dialog appear on your device. Disconnect your device from your computer, connect it to your Gear VR, and review your scene.