> For the complete documentation index, see [llms.txt](https://fast-studios.gitbook.io/input-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fast-studios.gitbook.io/input-hub/manual/getting-started.md).

# Getting Started

Install Input Hub, try the example scenes, and make your first action and prompt.

## Installation

{% stepper %}
{% step %}

### Open the Package Manager

In the **Unity Editor**, go to **`Window > Package Manager`**.

<figure><img src="https://4000150045-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ8w9t8jTgqZLSo9DvRCc%2Fuploads%2Fgit-blob-102c6202a3cb21f01084dec6d2010262f97082d1%2FInstallation.webp?alt=media" alt="The Package Manager entry in Unity&#x27;s Window menu"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Show your assets

In the **Package Manager**, click **Packages** and select **My Assets** on the left side of the screen.

<figure><img src="https://4000150045-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ8w9t8jTgqZLSo9DvRCc%2Fuploads%2Fgit-blob-98b30502a4ae7a084a268f9c3ef16fdadcf19bd3%2FInstallation2.webp?alt=media" alt="The My Assets list in the Package Manager"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Find Input Hub

From the list, choose **Input Hub**.
{% endstep %}

{% step %}

### Download

In the bottom right corner, click **Download**.
{% endstep %}

{% step %}

### Import

And finally, click **Import**.
{% endstep %}
{% endstepper %}

{% hint style="success" %}
**Input Hub** works out of the box. It comes with its settings ready and the Xelu's icon pack installed, so you don't need to set anything up to start.
{% endhint %}

Everything Input Hub adds lives in **`Fast Studios/Input Hub`**. You can move the **Fast Studios** folder anywhere inside **Assets**, like **`Assets/Plugins`** or **`Assets/Third Party`**, to keep your project organized your own way. Input Hub finds itself wherever it is, so the paths in this documentation start at **Fast Studios**.

### Which input system?

Unity has two input systems: the old **Input Manager** and the newer **Input System** package. Input Hub works with either one, or with both at the same time, so you don't need to change anything. It reads through whatever your project has on in **`Edit > Project Settings > Player > Active Input Handling`**.

If your project uses the Input System and has **Project-wide Actions** (new Unity 6 projects come with them), the first time you open the Input Hub window it asks if you want to turn those actions into Input Hub actions. You can learn more about this on the [Input System](/input-hub/manual/input-system.md) page.

## Example Scenes <a href="#example-scenes" id="example-scenes"></a>

The quickest way to see what Input Hub can do is to play with it. Open **`Fast Studios/Input Hub/Examples/General Scene`** and press **Play**.

{% hint style="info" %}
The example scenes use TextMesh Pro. In a new project, Unity asks to import the **TMP Essentials** the first time you open one: click **Import TMP Essentials**, or use **`Window > TextMeshPro > Import TMP Essential Resources`**. Until then, the texts don't show.
{% endhint %}

The **General Scene** is a menu with a card for every example. Pick one and it opens, with a button in the corner to come back. You can also open it from **`Tools > Fast Studios > Input Hub > Settings`**, in the **General** tab.

The [Example Scenes](/input-hub/manual/example-scenes.md) pages explain what each scene shows and how it uses Input Hub, so you can do the same in your own game.

## Your First Action <a href="#your-first-action" id="your-first-action"></a>

An **action** is something the player does, like **Jump**. It holds every key and button that does it: Space on the keyboard, A on the gamepad, a button on a touch screen. Your code asks for the action, never for a key, so the player can change the keys and your code doesn't care.

{% stepper %}
{% step %}

### Open the Input Hub window

Go to **`Tools > Fast Studios > Input Hub > Open Input Hub`**.

This window is where you create and edit all your actions.
{% endstep %}

{% step %}

### Create the action

At the bottom of the list, click **New Action**, type **Jump** and press **Enter**.

The action appears in the list and opens on the right side of the window.
{% endstep %}

{% step %}

### Give it a key

A new action already comes with one empty binding card under **BINDINGS**. Click **Listen** on that card and press **Space**.

Click **Listen** again and press the **A** button on your gamepad. The same card now answers to both, and its title shows everything it reads.
{% endstep %}

{% step %}

### Apply

A bar at the top of the window now says **1 unsaved change**. Click **Apply**.

Apply writes your new action into a small file called **HubIds.cs**, so your code can write `HubAction.Jump` with autocomplete instead of typing the name by hand. Unity recompiles the scripts once after that. You can create many actions and press **Apply** only once at the end.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
The action works by its name right away, even before **Apply**. Apply only matters for the `HubAction` names in code. If you enter Play Mode with changes still waiting, Input Hub asks whether to apply them first.
{% endhint %}

If the gamepad does not answer the **Listen** button outside Play Mode, see [Listen](/input-hub/manual/actions-and-axes/bindings.md#listen) for the reason and the way around it.

## Reading It in Code <a href="#reading-it-in-code" id="reading-it-in-code"></a>

Add `using FastStudios.InputHub;` at the top of your script and ask for the action by its name:

```csharp
using UnityEngine;
using FastStudios.InputHub;

public class Player : MonoBehaviour
{
    void Update()
    {
        if (InputHub.Down("Jump"))
        {
            // The frame the player presses Space, or A on the gamepad.
        }
    }
}
```

`Down` is true on the frame the button goes down, `Held` while it stays down, and `Up` on the frame it is let go.

After **Apply**, you can use the generated name instead of the text, which catches typos before you press Play:

```csharp
if (InputHub.Down(HubAction.Jump))
```

You can also add the action as a field and drag it in the Inspector:

```csharp
public InputHubAction Jump;

void Update()
{
    if (Jump.Down)
    {
        // Jump!
    }
}
```

The field shows a picker with the icons of its keys and buttons, so you can see at a glance what each one does.

<figure><img src="https://4000150045-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ8w9t8jTgqZLSo9DvRCc%2Fuploads%2FiWxc2dmfrSF4ARMGdz9m%2FInputHubAction.png?alt=media&amp;token=de35ad2a-d68e-4c08-bbac-02e478b45108" alt=""><figcaption></figcaption></figure>

### Movement

Things that move, like walking or looking around, are **axes** instead of actions. An axis gives you a `Vector2`.

Open the **Axes** tab of the Input Hub window, click **New Axis** and name it **Move**. A new axis already reads **W, A, S** and **D**. Click **+ Add Binding**, set the new card's **Source** to **Stick**, and the left stick moves it too. Then read it:

```csharp
Vector2 move = InputHub.Move("Move");
```

The keyboard and the stick add up, so the player can use either one. To learn everything an axis can do, see [Axis Sources](/input-hub/manual/actions-and-axes/axis-sources.md).

## Your First Prompt <a href="#your-first-prompt" id="your-first-prompt"></a>

A **prompt** is the little "**E** Open" on screen that tells the player which button to press. Input Hub draws it with the icon of the device the player is using, and swaps it the moment they switch.

{% stepper %}
{% step %}

### Create the prompt

Select your **Canvas** in the Hierarchy and go to **`GameObject > Fast Studios > Input Hub > Input Prompt`**.

If the scene has no Canvas yet, Input Hub creates one for you.
{% endstep %}

{% step %}

### Write the text

In the Inspector, the **TEMPLATE** box holds the text of the prompt. Each action goes between braces, and turns into its icon:

```
{Jump} to jump
```

You can type the braces yourself, or click **+ Insert** to pick an action from a list.
{% endstep %}

{% step %}

### Press Play

With your script reading **Jump**, the prompt shows the Space icon. Touch the gamepad and it becomes the A icon. Press a key and it comes back.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
By default a prompt only shows **when needed**: while some script is reading one of its actions. A door prompt appears when the door script starts asking for **Interact**, and goes away when it stops. To keep a prompt on screen all the time, set its **Show** to **Always**. The [Input Prompt](/input-hub/manual/prompts/input-prompt.md) page covers this in detail.
{% endhint %}

That's it! You have an action, you read it in code, and the player sees which button to press on any device. From here, the [Actions and Axes](/input-hub/manual/actions-and-axes.md) section goes deeper into everything an action can do.
