How to set Mouse Visibility?

Started by Dobby · 5 months ago · 2 replies · 165 views

#1
Dobby
Member
JoinedApr 2026 Posts10 Score2,650
Hi, sorry if this is a stupid question.
I'm an absolute beginner when it comes to programming. 
I only have experience with C for Arduino projects, but it looks like this doesn't help me much with S&Box. 
I'm not able to figure it out on my own, and neither ChatGPT nor Gemini can solve my problem.

Currently, I use Mouse.Visible = true; to make the mouse visible.
However, I get a warning in the console telling me that I should not use this command.
Instead, I should use the new Visibility command from the docs: https://sbox.game/api/Sandbox.Mouse.

But I can't figure out how it works. No matter what I try, all I can get are errors.
For now, I am still using Mouse.Visible = true, but it would be great if someone could give me an example of how I can use the new command.

#2
sleeppyy
Member
JoinedMay 2021 Posts9 Score1,185
It's Mouse.Visibility you're supposed to use

You need to assign it a value of the https://sbox.game/api/Sandbox.MouseVisibility enum, i.e Mouse.Visibility = MouseVisibility.Visible;
#3
Dobby
Member
JoinedApr 2026 Posts10 Score2,650
Thank you very much!
I always tried it like this: Mouse.Visibility = true, Mouse.Visibility(Visible) in different variations.
But your version works perfectly! 
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.