Description
The MouseCursorVisible
property is a static boolean property within the Sandbox.Input
class. It indicates whether the mouse cursor is currently visible, typically when interacting with UI elements or other components that require cursor visibility.
Usage
To check if the mouse cursor is visible, you can directly access the MouseCursorVisible
property. This is useful in scenarios where you need to determine the visibility state of the cursor, such as when toggling UI elements or handling input differently based on cursor visibility.
Example
// Example: Checking if the mouse cursor is visible
if (Input.MouseCursorVisible)
{
// Perform actions when the mouse cursor is visible
// For example, enable UI interactions
}
else
{
// Perform actions when the mouse cursor is not visible
// For example, enable game controls
}