> For the complete documentation index, see [llms.txt](https://cowsinss-organization.gitbook.io/fps-engine-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cowsinss-organization.gitbook.io/fps-engine-documentation/how-to-use/adding-custom-key-rebinds.md).

# Adding Custom Key Rebinds

<mark style="background-color:orange;">New in FPS Engine 1.2</mark>

FPS Engine 1.2 introduced Key Rebinding, allowing all provided inputs to be reconfigured in the Main Menu. However, there may be situations where you need to add custom actions and bindings that should also be rebindable.

To start, we need to create the custom action. Open the PlayerActions file located in Cowsins/Inputs.

<figure><img src="https://2716441118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkdlNMXOYYmupb4VpBGHT%2Fuploads%2FfjNAioFLqiUTuv9gjlmO%2Fimage.png?alt=media&amp;token=8b2ac661-1ef3-4ce0-9de4-5e0efcad5d53" alt=""><figcaption></figcaption></figure>

This window will pop up:

<figure><img src="https://2716441118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkdlNMXOYYmupb4VpBGHT%2Fuploads%2F7VGF46XHUJIlm6BRIFkt%2Fimage.png?alt=media&amp;token=1bc5e039-63ba-4620-bff8-519353ac48da" alt=""><figcaption></figcaption></figure>

Please note that "All Control Schemes" is selected. Because of that, we will be able to see and edit both inputs for keyboard & mouse and controller.

Click on the "+" Icon to Create a new Action and give it a name.&#x20;

<figure><img src="https://2716441118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkdlNMXOYYmupb4VpBGHT%2Fuploads%2FfQcpHCD6LXnNBKsI0HKc%2Fimage.png?alt=media&amp;token=480e4831-2060-46a5-adb3-ad2ac5bafdc3" alt=""><figcaption></figcaption></figure>

For each action, you can assign multiple bindings. In this example, we'll add one for the keyboard and one for the controller. First, duplicate the empty binding. Then, modify the path for each binding, making sure to enable either "Keyboard" or "Gamepad" depending on the control scheme for that binding. Save the PlayerActions file and close it.

<figure><img src="https://2716441118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkdlNMXOYYmupb4VpBGHT%2Fuploads%2Fa2Yn4VpM1S48kclJL7Qz%2Fimage.png?alt=media&amp;token=c3fa86ca-9256-4353-a371-533a9af6af77" alt=""><figcaption></figcaption></figure>

Navigate to Cowsins/Demo/Main Menu and open the Main Menu scene. Next, locate the Rebind UI Buttons within the scene.

<figure><img src="https://2716441118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkdlNMXOYYmupb4VpBGHT%2Fuploads%2FSMrEe4MlrJhDPfPaPtcr%2Fimage.png?alt=media&amp;token=3c11d0a9-4558-4eda-af01-59362d9112f2" alt=""><figcaption></figcaption></figure>

You can duplicate any of the Rebind Buttons. Once you select the duplicated button, you'll see it has a [RebindUI ](/fps-engine-documentation/content/03.-content/03.8-ui/rebindui.md)component. Here, you can choose the desired action and binding.&#x20;

For instance, you can set it to rebind the Keyboard H key from the NewAction action that we just created.

<figure><img src="https://2716441118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkdlNMXOYYmupb4VpBGHT%2Fuploads%2FQRfgyp61ozR36HbVOHUm%2Fimage.png?alt=media&amp;token=efe43da4-471e-4497-bb60-c860fe9ca6b2" alt=""><figcaption></figcaption></figure>

If we change the SelectedBinding to the next index value, we will now be rebinding the Gamepad binding, since it is the next available binding within the action that was created previously.

<figure><img src="https://2716441118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkdlNMXOYYmupb4VpBGHT%2Fuploads%2FkW4XmR0hU5oz5LhjgCdJ%2Fimage.png?alt=media&amp;token=491166ca-225e-406a-af82-c86ad31592d4" alt=""><figcaption></figcaption></figure>

Just like that, Rebind for a Custom Action is working!

<figure><img src="https://2716441118-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkdlNMXOYYmupb4VpBGHT%2Fuploads%2FQjHw5U3ccekdzeEedNQL%2Fimage.png?alt=media&amp;token=461080b1-ed0c-4bc1-ad1a-1b71869646a5" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
\[ IMPORTANT ]

Ensure you gather the input for your custom action through the InputManager, as this implementation won't work otherwise. The InputManager is responsible for handling all the inputs in the game.
{% endhint %}
