Improve Your GearVR Development: Tips from SDC2017 Sponsor, Unity

Improve Your GearVR Development: Tips from SDC2017 Sponsor, Unity

Dan Miller

Unity supports a wide variety of features and systems that can be leveraged in any GearVR application, and we are very excited to be part of SDC2017. This year, we’re looking forward to showing you how to take your VR experiences to the next level with the new GearVR controller. Before you arrive at SDC2017, I  want to be sure you have a strong VR-knowledge base for how to make your GearVR app smoother. Here are my top 4 tips for putting the finishing touches on your GearVR project.

1. Streamline your development with this script

In Unity, there are a couple steps you can take to simulate mobile VR inside of the editor. The gearVR headset only tracks the user’s head rotation. To simulate this in the editor, you can attach a script to the main camera that rotates the camera based on mouse position.

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class VRCameraLook : MonoBehaviour {

    Transform transform;

    void Start ()
    {
        transform = GetComponent<Transform>();
    }

    void Update ()
    {
        #if UNITY_EDITOR
        transform.localRotation = Quaternion.Euler(-Input.mousePosition.y, Input.mousePosition.x, 0);
        #endif
    }

}

 

With this script you can build up functionality and features in a more streamlined manner.

2. Simulate headset input for a smoother workflow

Another really good tip for building an application in the editor is using Input.GetMouseButtonDown(0)as a form of input. This is convenient because of the way Unity handles input across different platforms. For the GearVR mouse, Button 0 is the same input callback for when you touch the touchpad on the headset; for a PC mouse button, 0 is the left-mouse button. With this setup, you can test and iterate faster by staying in the Unity editor and only building to the device for more complex functionality.

3. Add an extra dimension with 360 video playback

Unity’s native video player has support for many different formats, including 360. This allows you to easily play any 360 content you have inside your applications. With a special skybox shader developed by Unity, you can also play this content in the ‘backdrop’ of any scene you make. You can transition between videos easily and even drop 3D objects and models inside of your 360 videos for more interactivity.

4. Profile early and often to track issues

For any mobile VR application, optimizations and performance are crucial for creating a good user experience. Unity allows you to auto-connect the profiler as well as remote-debug your application from the editor.

You can see more about how the profiler works and gain an understanding of the graphs and interface here. This will allow you to track down expensive processes or troublesome code in your applications.

 

Register for SDC2017 today

 

To find out more useful tips and get a better understanding of how to use the new gearVR controller with Unity, come to my talk, Thinking Beyond a Rotation-Only Controllerat the Samsung Developer Conference in San Francisco, Oct 18-19, 2017.

In this talk, we’ll also discuss Unity Analytics and how it helps you improve your game and retain your customers.

Please also join us for the “Towards an AI Driven Open Metaverse” Panel session where Unity’s Director of AI research, Nicolas Meuleau will join Otoy’s CEO, Jules Urback.

 And finally please don’t forget to visit us at the Unity booth to check out our latest release and demos!

Join the Discussion

You need to to your Samsung Developer Program Account to post comments.
Don’t have an account? Sign Up here.