- Home /
Stop camera movement when paused?
I have a pause menu and I pause the game by setting time.timescale to 0 but when I pause and activate my ngui pause menu, the game behind it still moves as in the camera still rotates with the mouse. How do I stop that and just keep it still while the mouse moves around the menu?
What's causing the camera to rotate? Is it a script you attached? You could tweak the script so that it checks if time is stopped, or you could just set enabled
to false so that it stops updating while you're paused (remember to set it back, after).
I have a $$anonymous$$ouseLook script for it, I just tried to set enabled to false but it gave me an error which I just made another ticket for actually, it says an object reference needed for non-static member "$$anonymous$$ouseLook.Enabled"
heres the code
void Update() { if (Input.Get$$anonymous$$eyDown ($$anonymous$$eyCode.F12)) { ShowDebug = !ShowDebug; if (ShowDebug) { NGUITools.SetActive(DebugCopyButton, true); NGUITools.SetActive(DebugObject, true); } if (!ShowDebug) { NGUITools.SetActive(DebugCopyButton, false); NGUITools.SetActive(DebugObject, false); } }
if (Input.Get$$anonymous$$eyDown ($$anonymous$$eyCode.Escape)) {
Paused = !Paused;
if (Paused) {
$$anonymous$$ouseLook.Enabled = false;
Time.timeScale = 1;
NGUITools.SetActive (Pause$$anonymous$$enu, false);
}
if (!Paused) {
$$anonymous$$ouseLook.Enabled = true;
Time.timeScale = 0;
NGUITools.SetActive (Pause$$anonymous$$enu, true);
}
}