The KeyboardCode
property of the InputAction
class specifies the key or key combination that the input action will monitor. This property is used to define which keyboard input will trigger the action within the game.
The KeyboardCode
property of the InputAction
class specifies the key or key combination that the input action will monitor. This property is used to define which keyboard input will trigger the action within the game.
To use the KeyboardCode
property, assign it a string value representing the desired key or key combination. This value will be used by the input system to detect when the specified key(s) are pressed.
// Example of setting the KeyboardCode property InputAction jumpAction = new InputAction(); jumpAction.Name = "Jump"; jumpAction.KeyboardCode = "Space"; // Set the action to trigger on the Space key // Example of using the action in a game loop if (Input.Pressed(jumpAction.Name)) { // Execute jump logic }