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?

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.