Description
The MouseVisibility.Auto
field is a member of the MouseVisibility
enumeration in the Sandbox namespace. It specifies that the mouse cursor is only visible when UI elements with pointer-events: auto
are present on the screen. This allows for dynamic control of the mouse visibility based on the presence of interactive UI components.
Usage
Use MouseVisibility.Auto
when you want the mouse cursor to appear only when there are UI elements that can be interacted with. This is useful in scenarios where you want to minimize distractions by hiding the cursor when it is not needed.
Example
// Example of setting mouse visibility to Auto
MouseVisibility currentVisibility = MouseVisibility.Auto;
// Check the current mouse visibility state
if (currentVisibility == MouseVisibility.Auto)
{
// Perform actions knowing the mouse is only visible with interactive UI
// For example, update UI elements or game logic accordingly
}