> For the complete documentation index, see [llms.txt](https://abdys-organization.gitbook.io/2d-ultimate-side-scroller-character-controller/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://abdys-organization.gitbook.io/2d-ultimate-side-scroller-character-controller/content/input-system.md).

# Input System

The input system of the 2D platformer-sidescroller controller asset is based on Unity's new input system. It uses an `InputActions.inputactions` asset to define a set of input actions and an action map named "Player". The action map contains various actions such as Walk, Jump, Dash, Crouch, WallGrab, and WallClimb. The `PlayerInputManager` script utilizes the input actions and action map to manage and process user inputs from different devices like keyboards and gamepads

### PlayerInputManager Script

The `PlayerInputManager` script is responsible for detecting and processing player input. It initializes an `InputActions` object to use the input map from the new input system, and it stores input values in private variables. The script also provides public properties to access these input values.

#### Initialization and References

In the `Awake` method, the script initializes the `InputActions` object, and sets up references to the `PlayerMain` and `PlayerData` components.

#### Input Event Functions

The `OnEnable` method is used to enable the input system and assign events to actions for detecting and processing input from the player. The input event functions include:

* `OnJumpStarted` and `OnJumpCanceled`: Triggered when the jump input starts and is canceled, respectively.
* `OnWalk`: Triggered when the walk input is performed or canceled.
* `OnDash`: Triggered when the dash input is performed or canceled.
* `OnCrouch`: Triggered when the crouch input is performed or canceled.
* `OnWallGrab`: Triggered when the wall grab input is performed or canceled.
* `OnWallClimb`: Triggered when the wall climb input is performed or canceled.

#### FixedUpdate and UpdateTimers

The `FixedUpdate` method calls the `UpdateTimers` method, which updates the timers related to coyote time, jump buffer, and dash cooldown.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://abdys-organization.gitbook.io/2d-ultimate-side-scroller-character-controller/content/input-system.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
