# Input Management

{% hint style="success" %}
Make sure that **Active Input Handling** in&#x20;

"*Project Settings > Player*" is set to **Both** or **Input System Package (New)**.&#x20;

Our recommendation is Both. This way, you can use both the new and old input systems. Using the old input system can be faster when creating inputs for testing purposes.
{% endhint %}

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FnHEugBtAH65h5nobDNAa%2FActiveInputHandling.png?alt=media&#x26;token=426248d4-f818-4571-94d8-c988ca635053" alt=""><figcaption></figcaption></figure>

## How to Change the Talk Button or Any Input?

1. Double click on the "**Controls**" asset in your project tab. <br>

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2F27EF3Exxk63iQGvuIuWY%2Fimage.png?alt=media&#x26;token=ea1bd3ee-3d98-40c3-8df6-0f78b2ce15bc" alt=""><figcaption></figcaption></figure>
2. You can setup multiple control schemes for different devices here, currently we have it for PC (Keyboard & Mouse) and Gamepad. For mobile, we have provided joystick and buttons, which are mapped to Gamepad controls for functionality, but you can directly add touchscreen and use its different features to trigger an Input Action. You can also add your own control scheme if you want support for a different device by clicking on "Add Control Scheme".&#x20;

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2Fk4BWLFrgSN3kLiWFk6Nw%2Fimage.png?alt=media&#x26;token=d161daa8-bbc8-4330-ad1e-4476f4f84f47" alt=""><figcaption></figcaption></figure>

3. Find the Input Action you want to change in the above window. If you want to add a new Input Action, refer to the other section in documentation. In this case, we selected "**Talk Key Action**" to change the talk button. Click on "**T \[Keyboard]**". In the Binding Properties window, click on the " **T \[Keyboard]** " button in the Path field.<br>

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FXntfJHlsNoAYi7eH725N%2Fimage.png?alt=media&#x26;token=733b241a-0fa9-4b32-90a3-da572c898ba2" alt=""><figcaption></figcaption></figure>

4. Press the " **Listen** " button in the top left of the opened window. If you prefer, you can choose your desired input from the categories below.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FT2h3hum3nvVmi5D6V1Mv%2FPressListenButton.png?alt=media&#x26;token=fff80f2a-948a-4050-8f07-8a14bfbfe1c8" alt=""><figcaption></figcaption></figure>

6. Press the key you want to assign and it will be reflected in the control asset.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FAGkirDWUoCxluysgUalM%2FPressKey.png?alt=media&#x26;token=7689ea3a-52fc-4799-9136-5c249b2f986e" alt=""><figcaption></figcaption></figure>

## How to Add a New Input Action?

1. First, go to the controls asset mentioned above and use the add button to create an input action. For this example, we will call it interact and provide it the binding with \[E] button.<br>

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FzVLxZpn6nk52W8uhDBWz%2Fimage.png?alt=media&#x26;token=91364302-d110-4c46-8151-7aa45421b807" alt=""><figcaption></figcaption></figure>

2. Then, click on the \<No Binding> item to setup binding for this action. As before, you can use the listen button (has a UI bug for Windows but works) or you can select the key from dropdown. After selecting the binding (we will select \[E] key for this), don't forget to press on the Save Asset option on the top menu. <br>

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FXjOG9y4DBQsMnBLwoBSF%2Fimage.png?alt=media&#x26;token=9d888b26-b210-46f7-ae63-78522b8515e8" alt=""><figcaption></figcaption></figure>

3. You will now get an error saying ConvaiInputManager does not implement OnInteract. We need to implement this. Open the " **ConvaiInputManager.cs** " script to do so.                                                                                           ( " *Convai / Scripts / Runtime / Core / ConvaiInputManager.cs* " )

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2Fx24yDyHnk1IT7WLhoFDs%2Fimage.png?alt=media&#x26;token=3658cb39-481f-47bc-84f0-a887453634a1" alt=""><figcaption></figcaption></figure>

4. Your IDE might suggest you to implement missing members. If it doesn't we can manually write the OnInteract function like in the last figure shown. You receive a callback context which shows which frame input started, performed or got cancelled which you can use for different purposes. And that's it the error should be gone and you are good to go!<br>

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FF6aHUT0hj6YStRvsXi1Z%2Fimage.png?alt=media&#x26;token=7db35f6e-2713-463c-92b2-50a9ecbe95ac" alt=""><figcaption></figcaption></figure>

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2Ffw02nx8EWBkmOlJakAIN%2Fimage.png?alt=media&#x26;token=fd5fdf7a-a9a4-4b16-a000-9581d2d296b9" alt=""><figcaption></figcaption></figure>
