- Home /
Locking Camera When Changing to Ingame Menu.
Hi there, Whilst switching from game to ingame menu It locks cusor and unlocks it so i can click buttons in menu. Though whilst the menu is up when I move cursor around to use menu it moves the FPS camera aswell. I simply want to just lock that camera and unlock it when in use. Is there something like Screen.lockCursor or would I need to lock all axes and unlock them (if so any idea) Newbie. THough ill understand most scripts.
Answer by Bampf · Sep 01, 2010 at 10:40 AM
You'll either need to: 1) temporarily deactivate the script that is moving the camera, or 2) change the camera script so that it checks whether your in-game menu is visible or not before moving the camera.
(2) is probably the way to go. One way to do it would be to create a static method that the camera script can call, IsMenuShowing() or something like that. Or a global variable. Another was would be for the menu to send a message to the camera when it activates or deactivates.
If you find that lots of objects need to know when the menu is showing, you may eventually want to move to a messaging system.
Your answer
![](https://koobas.hobune.stream/wayback/20220613072458im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Camera (view locking and movement) on a rigidboy 2 Answers
How to make camera position relative to a specific target. 1 Answer
How can I lock my camera on the Y-axis? 0 Answers
Camera Lock 1 Answer