Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
ChiaraStellata's avatar
12 years ago

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

1 Reply

Replies have been turned off for this discussion
  • Gerald's avatar
    Gerald
    Expert Protege
    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. :)