|
is it possible to disable the mouse look script applied to a camera? The problems is that I have several GUI buttons that I need to use, but I'm using a FPS camera with the mouse look and cursor lock scripts applied to it. I want to be able to unlock the cursor, use the GUI buttons and then lock the cursor again. While the cursor is unlocked I want the camera to stop moving with the movement of the mouse. Any thoughts?
(comments are locked)
|
|
Since you are using the Here is an example on how you can disable/enable
The above example disables and enables the wow thats a lot..this is exactly what I was looking for..just one question..how can I lock the cursor when I activate the mouse look?
Mar 18 '10 at 08:01 PM
maveryck21
Better to just toggle the enabled value; you can get rid of most of that code: "if (Input.GetKeyDown(KeyCode.Escape)) for (look in mouseLook) look.enabled = !look.enabled;" Also use "private var mouseLook : MouseLook[];" to avoid slow dynamic typing.
Mar 18 '10 at 08:02 PM
Eric5h5
@maveryck21 I updated the code with the lockCursor included. @Eric5h5 I'm aware of that.. and I was thinking of doing that but toggling the the MouseLook but this will be only useful in this example with the Escape... Obviously maveryck21 would like to use it in a more complex way :) Hopefully...
Mar 18 '10 at 08:09 PM
Lipis
@maveryck21 the web player is a different case especially with the Escape key... more details here: http://unity3d.com/support/documentation/ScriptReference/Screen-lockCursor.html
Mar 18 '10 at 08:42 PM
Lipis
I got this message when I saved it ... it doesn't like the mouselook =game.Object... at line five ... any suggestions ? i have a set up with a far and near camera but i use the default scripts.
Mar 26 '10 at 05:31 PM
alexnode
(comments are locked)
|
|
Hi guys, I found your solution and it helps me, but I still encounter an issue. I first had to change the beginning part of the script to :
Then everything is ok, BUT, I have the same issue than when I tried my own script. One I hit Escape, the cursor unlocks and shows off, but if I hit ESC again, even if the mouseLook scripts are activated again, the mouse cursor still shows off. I'm using Unity 3.3. Does anyone one know what's happening? Thanks for unlightning me ;)
(comments are locked)
|

My guess is that you are using the
First Person Controllerprefab from Standard Assets... correct?@Lipis yes..not exactly the same but with the same configuration