Skip to content

Example 0.Tutorial

Lawrence Wong edited this page Aug 25, 2017 · 8 revisions

This example shows how to build up the basic environment that can interact with Unity built-in UI component.

  • After opening a new scene, remove default Main Camera and add the ViveCameraRig prefab to setup a basic VR scene. This prefab simply include VR devices like HMD(Camera), controllers and trackers.

tutorial_01


  • Add VivePointers prefab into the scene. This prefab contains 2 event raycasters that can interact with the UI elements.

tutorial_02


  • Create an UI button in hierarchy.

tutorial_03


  • Remove default event system object (Optional).
  • Select default canvas object.
  • Remove canvas scalar component (Optional).
  • Remove graphic raycaster component (Optional).
  • Set render mode to "World Space".

tutorial_04


  • Click "Add Component" to add the CanvasRaycastTarget script.

tutorial_05


  • Set rect transform on canvas and button to locate them into your VR camera's sight.

tutorial_06 tutorial_07


  • UGUI now catches events from your Vive controllers!
  • You can find the complete scene in Asset/HTC.UnityPlugin/ViveInputUtility/Examples/0.Tutorial

tutorial_08