top of page

How to create a simple digital prototype for a VR application with Unity and Google Cardboard



Preparation:

  • Hardware: An iPhone and a Google Cardboard

  • Software: 

    • Unity 1.7 (I don’t recommend the latest version because it may cause some mysterious version cooperation problem )

    • Xcode where you build your VR application on your phone so that you can view the VR scene in the Google Cardboard.

The Interaction we’re going to prototype:

  1. Gaze at a button, it will be highlighted.

  2. Click on the button, the door will open and then we will switch to another scene.

Process:

  • 2D Graphic software to create the 2D interaction component: First, we need to prepare the 2D interfaces we will use in the 3D scene, like the button and the hover state of it.

  • It will become the texture of a 3D button in the Unity scene.

  • Drag this image into Unity and attach it to the button, it will become a Material of this button, which you can change by script.



  • Adding a script on the button that contains a function which can change the material of the button when calling it.



  • Then in the event trigger of the button to call the function you create when the gaze enter on and out



  • Play the door open animation when clicking on the button -  door.GetComponent<Animation>().Play("door_open”); disabled the “static” label

  • Load the next scene -  using UnityEngine.SceneManagement; SceneManager.LoadScene("OtherSceneName", LoadSceneMode.Additive);

    • You may encounter the following problem: 

Scene 'VRLearning' couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.

To add a scene to the build settings use the menu File->Build Settings…

  • Build the application: Play setting and build setting (switch the platform)

  • Build it on your iPhone: Run the xcworkspace. I finally found out that i had to open the xcworkspace instead of the xcodeproj. Using the xcworkspace, there is a "Pods" that is added and compiled before the unity project.

How to build a Xcode project on your phone
  • https://blog.csdn.net/jianloubang5433/article/details/51871805

  • IOS google cardboard / gvr screen size cut in half : I also encountered this bug when using GoogleVR. Enabling VR disables your ability to edit the "Default Orientation" field in the "Settings for iOS" under "Player Settings". The way I solved this was to disable VR, set the Default Orientation to "Landscape Left" and then reenable VR. It looks like this should be fully overridden but it seems to be a bug.

18 views0 comments

Recent Posts

See All

A-Frame AR First Try

1. 360 sketch image <a-curvedimage > 2. 3D models: Google poly https://developers.google.com/poly/develop/web API application and add...

Comments

Couldn’t Load Comments
It looks like there was a technical problem. Try reconnecting or refreshing the page.
bottom of page