- Home /
How to Camera Rotation when UI is up?
Hi,
I am trying to script in a function where the first person controller camera controls is frozen if any UI canvas' are up. I have tried to do this with the script:
if ((canvas.enabled == true) || (canvas2.enabled == true) ||( canvas3.enabled == true) {
//DISABLE CAMERA ROTATION
gameObject.GetComponent<FirstPersonController>().enabled = false;
} else{
//ENABLE CAMERA ROTATION
gameObject.GetComponent<FirstPersonController>().enabled = true;
}
But the issue I get is that the whole mouse function is disabled. As in, I cannot move the mouse around.
Another method I tried to fix the issue was editing the FirstPersonController.cs script by making the m_MouseLook variable public and altering some components but that didn't work also. (For the same reason as disabling the script).
Any idea's or suggestions would be greatly appreciated.
Your answer
Follow this Question
Related Questions
I want the camera, which is following my spaceship, to rotate to wherever the cursor is looking 0 Answers
Camera following player gameObject,Camera follows player, with script attached. 1 Answer
Forward and back movements with a camera emulating an isometric view 1 Answer
MoveRotation stops working while player is moving 0 Answers
How to make the camera follow the player while still being able to be rotated? 1 Answer