15
EXERCISE 2: CREATING THE SPLASH S Samsung Developers US (../../../index.html) > Developer Resources (../../../developer- resources.html) > Gear VR (../../gear-vr.html) > Apps and Games (../apps-and-games.html) > Exercise 2: Creating the Splash Scene The 360 image viewer app will contain two scenes—a splash scene and a main scene. When the app is launched, the splash scene will display a 360 image along with a logo. This scene will display for a few seconds, ultimately, allowing the app some time to load the main content. HOME (../../../INDEX.HTML) APP SHOWCASE (../../../APP-SHOWCASE.HTML) EVENTS (../../../EVENTS.HTML) BLOG (../../../BLOG.HTML) DEVELOPER RESOURCES (../../../DEVELOPER-RESOURCES.HTML) SIGN UP (../../../SIGN-UP.HTML) (EXERCISE-2-CREATING-THE-SPLASH-SCENE.HTML# ) SAMSUNG DEVELOPERS US (../../../INDEX.HTML) (exercise-2-creating-the-splash-scene.html#)

: exercise-2-creating-the-splash-scene.html

Embed Size (px)

DESCRIPTION

: exercise-2-creating-the-splash-scene.html

Citation preview

Page 1: : exercise-2-creating-the-splash-scene.html

EXERCISE 2: CREATING THE SPLASH SCENE

Samsung Developers US (../../../index.html) > Developer Resources (../../../developer-resources.html) > Gear VR (../../gear-vr.html) > Apps and Games (../apps-and-games.html) >Exercise 2: Creating the Splash Scene

The 360 image viewer app will contain two scenes—a splash scene and a main scene.

When the app is launched, the splash scene will display a 360 image along with a logo.

This scene will display for a few seconds, ultimately, allowing the app some time to load

the main content.

HOME (../../../INDEX.HTML) APP SHOWCASE (../../../APP-SHOWCASE.HTML)

EVENTS (../../../EVENTS.HTML) BLOG (../../../BLOG.HTML)

DEVELOPER RESOURCES (../../../DEVELOPER-RESOURCES.HTML)

SIGN UP (../../../SIGN-UP.HTML)

(EXERCISE-2-CREATING-THE-SPLASH-SCENE.HTML#)

SAMSUNG DEVELOPERS US(../../../INDEX.HTML)

🔎 (exercise-2-creating-the-splash-scene.html#)

Page 2: : exercise-2-creating-the-splash-scene.html

In this exercise, you will learn how to:

Create a scene in a Unity project

Add game objects to a scene

Apply materials to objects

Add a prefab to the scene

Manage scene lighting

Create an Oculus Signature File

Edit the player settings

Build and run the Unity project on a Gear VR device

Build the splash screen

Return to Unity.1.

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

In the Save Scene dialog, name the �le Splash.unity and save it to the /Assets

/Workshop/Scenes folder in your Unity project.

3.

Note: In the /Scenes/CatchUpScenes directory, you will see multiple versions of the Splash

scene �le with a number pre�xed to the �le name. These numbers correspond to the exercises in

this series. We recommend that you create and use your own scenes, but if you would like to

start with clean �les, you are welcome to use the provided �les.

In the Hierarchy view, select the Main Camera object. You will see the object selected4.

Page 3: : exercise-2-creating-the-splash-scene.html

in the Scene view and its details displayed in the Inspector view.

The Hierarchy view shows you the relationship of all of the objects in a scene. The Scene

view displays your scene in free point of view (you can look at the scene from all angles).

The Inspector view displays all of the components and properties of a selected object in

a scene.

In the Inspector view, disable the Main Camera by unchecking the box next to the

object name.

5.

Add a cube mesh to the scene

Now you can begin adding content to your splash scene. You’ll start by adding a game

object. Considered a building block of a Unity project, a game object can be a piece of

geometry or script that is de�ned by speci�c components, or object properties and

behaviors.

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).

1.

Page 4: : exercise-2-creating-the-splash-scene.html

The Box_Inv object is a 3D inverted cube mesh, or shape, that you will use as the

background of your splash screen. By default, this box has a plain gray texture, or

surface. You will place a different material on each side of the cube to create a

background image.

Apply materials to an object

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 Element 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

Splash scene.

1.

In the Project view, open the /Assets/Workshop/Materials folder. Here you will see2.

Page 5: : exercise-2-creating-the-splash-scene.html

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 �le into the Element 0 property �eld.

Repeat step 2 for the �ve remaining Element slots.3.

Add a prefab to the scene

In the Project view, open the /Assets/Workshop/Prefabs folder and drag the Logo_1

prefab into the Heirarchy view.

1.

Tip: Hold down the Alt/Option key and click-drag the scene to orbit around the view’s pivot

point. For more tips on using the Scene view, review the Unity Manual

(http://docs.unity3d.com/Manual/SceneView.html).

In the Inspector view, navigate to the Transform component and make sure the2.

Page 6: : exercise-2-creating-the-splash-scene.html

following values are set:

Position: (0, 0, 30)

Rotation: (-90, -180, 0)

Tip: 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.

From the menu, select Window > Lighting.3.

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

section.

4.

To the right of the Skybox �eld, click the Target button. In the Select Material

window, choose the Skybox material.

5.

In Scene view, review the Splash screen.6.

Page 7: : exercise-2-creating-the-splash-scene.html

Add the OVRCameraRig prefab

In the Project view, open the /Assets/OVR/Prefabs folder and drag

theOVRCameraRig prefab into the Hierarchy view. Placing the OVRCameraRig

prefab in a scene replaces the Main Camera provided in Unity and allows you to start

viewing the scene on Gear VR.

1.

Note: For more detailed information on the prefabs included in the Oculus Mobile SDK, review

the Oculus Mobile SDK documentation. (http://static.oculus.com/sdk-downloads/documents

/Oculus_Mobile_v0.5.0_SDK_Documentation.pdf)

In the Hierarchy view, expand the OVRCameraRig > Tracking Space object. Nested

within this object are the LeftEyeAnchor, CenterEyeAnchor, RightEyeAnchor, and

TrackingAnchor objects. Later in the workshop, you will use the CenterEyeAnchor to

implement a reticle and raycaster that will target and trigger buttons in the app.

2.

Page 8: : exercise-2-creating-the-splash-scene.html

At the top of the Unity window, click the Play button. In Game view, you will see your

Splash scene displayed. On your Gear VR headset, this scene will be rendered in two

side-by-side images, mapping to your left and right eyes, creating a stereoscopic view.

3.

Click the Play button again to stop the preview.4.

Note: Any changes made to your project while in Preview mode will not be saved. If you

preview your app, make sure to stop the preview before making changes.

Save the scene.5.

Download the Oculus Signature File

Page 9: : exercise-2-creating-the-splash-scene.html

Oculus requires that all applications accessing VR functionality use a unique signature

�le created with a speci�c Note 4 or S6/S6 Edge Device ID. This signature �le will access

low-level device functions through APIs provided in the Oculus Mobile SDK.

On your device, open the Device Id Fetch app. You will see your Device ID displayed

in the app.

1.

Note: You can also retrieve your Device ID by using ADB, a command line for the Android SDK.

Details on how to manually retrieve the Device ID are outlined in the Setup guides for Mac OS

X (setup-mac-os-x.html) and Windows OS (setup-windows-os.html) and you can also �nd

instructions on the Oculus Signature File Generator (https://developer.oculus.com/tools

/osig/) page.

On your computer, open a browser and navigate to the Oculus Signature File

Generator (https://developer.oculus.com/tools/osig/) page. Login to your Oculus

account. If you do not have an account, create one now.

2.

In the Device ID �eld, type in the Device ID retrieved from your device and click the

DOWNLOAD FILE button. Your Oculus signature �le will be downloaded to your

machine.

3.

Page 10: : exercise-2-creating-the-splash-scene.html

In your �le system, navigate to the location of your Oculus signature �le.4.

Return to Unity.5.

In the Project view, open the /Assets/Plugins/Android/assets folder and drag your

Oculus signature �le into the folder.

6.

Edit the Player Settings

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

In the Inspector view, review the current PlayerSettings. When you replaced the

ProjectSettings folder in your Unity project in the previous exercise, you

implemented default Player Settings from the Oculus Mobile SDK.

2.

Change the following settings:3.

Company Name: Add your company name here

Product Name: Hello World 360

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

Page 11: : exercise-2-creating-the-splash-scene.html

Expand the Other Settings section and change the Bundle Identi�er to

com.[yourComanyName].HelloWorld360.

4.

Build and run the application

Connect your device to your machine via USB.1.

The �rst time you connect the device to your machine, you will see the Allow USB

debugging? dialog appear on your device. Check the Always allow this computer box

and tap OK.

2.

Page 12: : exercise-2-creating-the-splash-scene.html

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

In the Build Settings window, click the Add Current button to add your Splash scene

to the Scenes In Build list.

4.

Page 13: : exercise-2-creating-the-splash-scene.html

Under the Android settings, make sure the Texture Compression is set to ETC2

(GLES 3.0).

5.

Click the Build And Run button.6.

In the Build Android dialog, give your APK �le a name and click Save. As the app

builds, you may be prompted to specify the location of the Android SDK root folder

on your machine.

7.

Once Unity has �nished 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.

8.

Sign Up for Emails about Samsung's Developer Tools and Events

Page 14: : exercise-2-creating-the-splash-scene.html

I have read the Privacy Policy (../../../privacy.html) and agree to the Samsung Developer Connection Terms andConditions. (exercise-2-creating-the-splash-scene.html#modal-1)

@SamsungDevUS (http://twitter.com/SamsungDevUS)

Follow @SamsungDevUS (http://www.twitter.com/SamsungDevUS).

Announcing the Gear VR Developer Program (../../../blog/announcing-the-gear-vr-developer-program.html)

Exciting New Speakers just Announced for GMIC SV 2014! (../../../blog/exciting-new-speakers-just-announced-gmic-sv-2014.html)

Nuance and Samsung Arm Developers with Innovation and Tools for the ConnectedLifestyle (../../../blog/nuance-samsung-arm-developers-innovation-tools-connected-lifestyle.html)

Win-Win: Using the Gear 2 as a Second Screen (../../../blog/win-win-using-gear-2-second-screen.html)

Develop Samsung Gear and Android Apps with the Tizen IDE for Wearable (../../../blog/develop-samsung-gear-android-apps-tizen-ide-wearable.html)

CONNECT

Search

🔎

Latest Tweets

Recent Posts

Page 15: : exercise-2-creating-the-splash-scene.html

©2015 samsungdevus.com (http://tes.iquariusmedia.com)

App Showcase (../../../app-showcase.html) Events (../../../events.html) Blog (../../../blog.html)

Developer Resources (../../../developer-resources.html) Privacy (../../../privacy.html)

Sign Up (../../../sign-up.html)