Zhenya Posted April 6, 2022 Share Posted April 6, 2022 I have an inventory in the game and I want that when opening this inventory, the mouse becomes free to move, and when the inventory closes, the cursor is fixed in the center of the screen. At the same time, it is desirable that in both cases the cursor is visible. Link to comment
alexander Posted April 7, 2022 Share Posted April 7, 2022 Hi Zhenya, Please try to use something like this: public void SetCursorEnabled(bool enabled) { if (enabled) { Input.MouseHandle = Input.MOUSE_HANDLE.USER; Gui.Get().MouseEnabled = true; App.MouseGrab = false; App.MouseCursorHide = false; } else { Input.MouseHandle = Input.MOUSE_HANDLE.GRAB; Gui.Get().MouseCursor = 0; App.MouseCursorHide = true; App.MouseGrab = true; ControlsApp.MouseEnabled = true; } } Best regards, Alexander 1 Link to comment
Zhenya Posted April 7, 2022 Author Share Posted April 7, 2022 2 hours ago, alexander said: Hi Zhenya, Please try to use something like this: public void SetCursorEnabled(bool enabled) { if (enabled) { Input.MouseHandle = Input.MOUSE_HANDLE.USER; Gui.Get().MouseEnabled = true; App.MouseGrab = false; App.MouseCursorHide = false; } else { Input.MouseHandle = Input.MOUSE_HANDLE.GRAB; Gui.Get().MouseCursor = 0; App.MouseCursorHide = true; App.MouseGrab = true; ControlsApp.MouseEnabled = true; } } Best regards, Alexander Your solution works best. I've already started coming up with excuses for the game - it's retro, get used to it. But you helped me solve this problem. Link to comment
Recommended Posts