Listen for the Input System's Action events via C#

Introduction

Last Update: Oct 19, 2019

unity input-system C#

Project Files

This tutorial was created with Unity version 2019.2.

In certain scenarios it may be beneficial to listen for Input System Action callbacks via C#, rather than using the built in Player Input component. This tutorial will walk through writing an InputManager script to listen for and route such events.

Learning Outcomes

  1. Understand the different Input System Action callbacks and how to hook them up via C#

Prerequisites

This is a continuation of the How to make a configurable camera with the new Input System tutorial, which covers fundamental knowledge of the Input System. While not recommended (unless you are already familiar with the Input System) you can skip tutorial by cloning the starterProject in the repository.

Tutorials in this Series

  1. Part 1: How to make a configurable camera with the new Input System
  2. Part 2: Listen for the Input System Action events via CSharp
  3. Part 3: How to select multiple objects based on the center of a collider
  4. Part 4: Challenge Solution: Extending the selection logic

Resources

  1. Input System documentation and GitHub repository.
  2. Introducing the new Input System - Unite Copenhagen Video
  3. This project uses the Low Poly: Free Pack by AxeyWorks.