void SetBind( string actionName, string buttonName )

book_4_sparkGenerated
code_blocksInput

Description

The SetBind method is used to assign a specific button to an action within the game. This method is part of the IGameInstance interface, which manages game input bindings. By using this method, developers can customize the control scheme by mapping actions to different buttons.

Usage

To use the SetBind method, you need to provide the name of the action you want to bind and the name of the button you want to assign to that action. This method is virtual, allowing for potential overrides in derived classes.

Example

// Example of using SetBind method
IGameInstance gameInstance = Sandbox.IGameInstance.Current;

// Bind the "Jump" action to the "Space" button
gameInstance.SetBind("Jump", "Space");

// Bind the "Shoot" action to the "LeftMouse" button
gameInstance.SetBind("Shoot", "LeftMouse");