x


Pop Up GUI Windows & Screen Lock Cursor Question

We've been working with pop up gui windows and so far we've managed to freeze both the camera and player (FPS controller) for when our pop up windows are activated.

Now we'd like to make it so the cursor is locked to the center of the screen during normal game play but that it becomes unlocked when our pop up window (windows) are activated and then returns to locked (to the center of the screen) when the pop up window is closed via a close button inside of the gui pop up.

Any thoughts on how this is done?

more ▼

asked Dec 13 '11 at 08:19 PM

Michael 12 gravatar image

Michael 12
132 85 98 106

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Set Screen.lockCursor = true; when the pop-up window comes up and to false when it goes away. You might also want to set Screen.showCursor = false; when the game is running and true when the window pops up.

This is the closest you can get to controlling the mouse location, as while you can get it's position, you cannot set it in any other way than lockCursor.

more ▼

answered Dec 13 '11 at 11:35 PM

asafsitner gravatar image

asafsitner
2.4k 2 8 19

hi michael-12 , i would like to know the code used to freeze the camera on pop up!! will you please help me!! Thanks in advance!!!

Mar 08 at 09:57 AM mrs
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x23
x21
x19

asked: Dec 13 '11 at 08:19 PM

Seen: 1093 times

Last Updated: Mar 08 at 09:58 AM