Forum Discussion

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

Unity Code working in DK1 no longer works for DK2

Hi there,

So this is a really simple camera switching script I had to flip between a fixed camera and a character controller camera. No problems with the DK1, and when in Unity, no problems for the DK2. However whenever I make a build, the first switch is fine, but when I try to toggle back, it freezes. Every time.

Anyone have any thoughts on why this is happening, or if there's a good alternative code for this action? Thank you!

Javascript:
#pragma strict

var playerCam:GameObject;
var mainCam:GameObject;


function Awake() {
playerCam.active = false;
mainCam.active = true;
}

function Update () {
if (Input.GetKeyDown(KeyCode.C))
{
playerCam.active = !playerCam.active;
mainCam.active = !mainCam.active;
}

}

1 Reply

Replies have been turned off for this discussion
  • This sounds like a bug in our rendering state machine. It looks like it is hanging when there are no active cameras. Can you always make them both active before deactivating one? If that doesn't work, can you use the same OVRCameraController all the time and make the keyboard shortcut change its position, rotation, and parent instead of activating/deactivating two?