Run gear vr in unity instead of mobile

Hello,

i am building an application for Gear VR, my problem is that everytime i want to see the modification i did on the app in realtime, i cant view it in unity, i press play but i cant move the reticle etc… so i need to build it and run it on my mobile. This process is lame and takes time.
Is there anything i can do to view the app in unity ? or am i doing anything wrong ?

Unity’s native “VR Mode” expects the device’s tracking to drive the camera, so without emulating that you can’t move the camera, track objects via gaze, etc.

What I do (since I also target Google Cardboard) is use the Cardboard package camera prefab, which allows emulating tracking in the editor. Then I made a menu script that allows me to choose between enabling Cardboard’s vr rendering and Unity’s native, and enable / disable Cardboard’s tracking emulation.

Something like this:

[MenuItem ("VRUtils/VR Mode/Cardboard")]
  static void modeCardboard () {
    PlayerSettings.virtualRealitySupported = false;

    viewer.VRModeEnabled = true;
    EditorUtility.SetDirty (viewer);

    head.trackPosition = true;
    head.trackRotation = true;
    EditorUtility.SetDirty (head);
  }

  [MenuItem ("VRUtils/VR Mode/GearVR - Editor (tracking enabled)")]
  static void modeGearVREditor () {
    PlayerSettings.virtualRealitySupported = false;

    viewer.VRModeEnabled = false;
    EditorUtility.SetDirty (viewer);

    head.trackPosition = true;
    head.trackRotation = true;
    EditorUtility.SetDirty (head);
  }

  [MenuItem ("VRUtils/VR Mode/GearVR - Build")]
  static void modeGearVRBuild () {
    PlayerSettings.virtualRealitySupported = true;

    viewer.VRModeEnabled = false;
    EditorUtility.SetDirty (viewer);

    head.trackPosition = false;
    head.trackRotation = false;
    EditorUtility.SetDirty (head);
  }

So essentially, my GearVR “editor emulation” is nothing more than no VR rendering but using Cardboard’s tracking emulation.

If you are not planning on supporting Cardboard, you can still download their package and take a look at the code to see how they emulate tracking and port / adapt that section to your own script.