6 Input

Like what your seeing?

Consider supporting us as a GitHub Sponsor and get instant access to all our Unity assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!

Introduction

This scene demonstrates the use of Steam Input API
It is important to understand what Steam Input is and how to properly configure it for your game.
Steam Input (Steamworks Documentation)
You must configure your app to use Steam Input and you must use Valve's concept of an "In-Game Action" (IGA) file to define the action sets, action set layers and actions your game has.
In-Game Actions File (Steamworks Documentation)
The Input tools provided by Heathen handle the integration with Steam Input in that you can define your sets, layers and actions as part of your Steam Settings object and easily activate them, fetch glyph data for them and of course query there state.
Heathen's tools take Valve's input system a step further and wrap all actions as GameEvents meaning you can handle Steam Input in a loop similar to traditional UnityEngine.Input or you as events similar to Unity's newer Input System.

What do I learn?

  1. 1.
    Using steam's Input API to handle controller input
  2. 2.
    Using Input API to get button images and names
  3. 4.
    How to access the Knowledge Base (where you are now)
  4. 5.
    How to access the support Discord
  5. 6.
    How to leave a review 😉

Instructions

To Test Input

  1. 1.
    Make sure you have Steam Client started and logged into a valid Steam user
  2. 2.
    Run the simulation
  3. 3.
    Observe the note in the window, you should see various actions listed
    If you see No Controller Found
    1. 1.
      Insure you have a compatable controller active (XBox, Steam or PlayStation)
    2. 2.
      Insure Steam's Input API has been forced to your app by running
  4. 4.
    With the session running and actions loaded operate the controller to see the values change.
The force input app ID command which can be ran from a browser should force Steam client to use input bindings for app 480.
The sample scene should clear this when it exits however if you find your Steam Input bindings are stuck on App 480 (Spacewars) you can run the command
steam://forceinputappid/0 to force it to clear

Objects

Manager

The manage game object has the Steamworks Behaviour component attached and will handle initialization of the Steam API on start up.

Controls UI

The controls UI uses standard Unity scripts and the Input Action Glyph and Input Action Name components to display the controls and mapped buttons to the user.

DEMO SCRIPTS

The demo script for this scene operates the Steam Input API by reading data from the attached InputAction objects and controls the active action set and layer by using the attached InputActionSet and InputActionSetLayer objects.