Skip to main content
Up and Coming
September 20, 2014

Workaround for non-functioning Editor Play

I experienced the same issues described in this thread where I wasn't able to use Editor Play mode because of random failing behaviour:

viewtopic.php?f=37&t=14330#p190480

So I implemented a simple workaround that appears to work in Tuscany and should also work in other Unity applications. It works by switching the OVRCameraController to play the game in regular monitor-mode when running in the editor. (You will need some way to turn without using the headset as the headset will be nonfunctional). Just add this code fragment to the beginning of Start() in OVRCameraController.cs:


if (Application.isEditor) {
gameObject.GetComponent<OVRCameraController>().enabled = false;
CameraRight.GetComponent<OVRCamera>().enabled = false;
return;
}


This disables two scripts: the OVRCameraController script itself, and the OVRCamera script on the right camera, which then takes over the Game window as a normal undistorted camera. In a build of the game running outside the editor, the above code does nothing, as desired. Here's a screenshot of it in action:

http://i.imgur.com/jDwIpbr.png
    This topic has been closed for replies.

    1 reply

    Up and Coming
    September 20, 2014
    wow - that is fantastic! still need to test it myself, but no longer having to switch cameras and getting the result of what it will look like in the Rift is worth gold!! Thank you so much for sharing. :)
    check out my Mobile VR Jam 2015 title Guns N' Dragons