static bool Pressed( string action )

robot_2Generated
code_blocksInput

Description

The Pressed method in the Sandbox.Input class is used to determine if a specific input action was pressed during the current frame. This method is useful for detecting single press events, such as when a player presses a button or key.

Usage

To use the Pressed method, pass the name of the action you want to check as a string parameter. The method will return true if the action was pressed during the current frame, and false otherwise.

Ensure that the action name corresponds to a valid input action defined in your game's input settings.

Example

// Example usage of the Pressed method
if (Input.Pressed("Jump"))
{
    // Execute jump logic
    Player.Jump();
}