Description
The WasLeftMousePressed
property is a static boolean property of the Gizmo
class in the Sandbox namespace. It indicates whether the left mouse button was pressed during the last frame. This property is useful for detecting mouse input events in a frame-by-frame manner, allowing developers to respond to user interactions with the mouse in their applications.
Usage
Use the WasLeftMousePressed
property to check if the left mouse button was pressed in the previous frame. This can be particularly useful in scenarios where you need to trigger actions based on mouse clicks, such as selecting objects or initiating drag-and-drop operations.
Since this property is static, you can access it directly through the Gizmo
class without needing to instantiate an object.
Example
// Example usage of WasLeftMousePressed
if (Gizmo.WasLeftMousePressed)
{
// Execute logic when the left mouse button was pressed in the last frame
// For example, select an object or start a drag operation
SelectObjectUnderCursor();
}