# Actions

### Basic Actions

Actions let you define input bindings that your players can rebind from the settings menu.

```typescript
// Define an action
Airship.Input.CreateAction("Dash", Binding.Key(Key.LeftShift));

// Listen to using the action
Airship.Input.OnDown("Dash").Connect(() => {
    print("Dash!");
});
```

### Core Actions

You can also hook into core actions or disable them in your game. Listening to core actions allows you to share a player's preferred keybinds from other games. The `CoreAction` enum holds the ID of each core actions in Airship.

```typescript
// Disable core jump & sprint actions
Airship.Input.DisableCoreActions([CoreAction.Jump, CoreAction.Sprint]);

// Listen to core primary action (by default left click)
Airship.Input.OnDown(CoreAction.PrimaryAction).Connect(() => {
    print("Swing sword");
});
```

<figure><img src="/files/tC1PfA5NrDZrTGefh2Nc" alt=""><figcaption><p>Settings menu after running the code snippets. Players can rebind any action without any work on your end.</p></figcaption></figure>

### Modifier Keys

For multi-key input you can create an action with a modifier key. Players can also rebind any actions to include a modifier.

```typescript
// Dash on Shift+G
Airship.Input.CreateAction("Dash", Binding.Key(Key.G, ModifierKey.LeftShift));

// Print out key display
const dashAction = Airship.Input.GetActions("Dash")[0]
const keyDisplay = dashAction.binding.GetDisplayName();
print("Press " + keyDisplay + " to dash!")
// prints "Press Left Shift + G to dash!"
```

### Update Action Binding

You can change a binding for a player through code. Unlike when a player changes their settings your binding changes will not be saved for the player beyond this session.

```typescript
dashAction.UpdateBinding(Binding.MouseButton(MouseButton.LeftButton));
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.airship.gg/unity-for-airship/user-input/actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
