Input Action

Definition

1
public class InputAction : GameEvent<InputActionData>
Copied!
Represents a Steam Input Action such as defined in your games IGA file.
These must be created as part of your Steam Settings object .

Fields and Attributes

Type
Name
Comment
InputActionType
type
The type of action (Analog or Digital)
string
actionName
The name of the action as it appears in the IGA file
InputAnalogActionHandle_t
AnalogHandle
The native Steam API handle if this is a analog handle and has been resolved.
InputDigitalActionHandle_t
DigitalHandle
The native Steam API handle if this is a digital handle and has been resolved.

Methods

Get Data

1
public InputActionData this[InputHandle_t controller];
Copied!
This returns the current cashed state for this action and for this controller, this does not update the state with the latest data from Steam it simply returns the last updated state. Typically you would have a behaviour poll all relivent actions at the start of an update and let various behaviours simply read the last known state for the actions they are interested in.

Example:

1
public class PlayerController : MonoBehaviour
2
{
3
Steamworks.InputHandle_t controller;
4
public InputAction someAction;
5
6
// ...
7
8
private void Start()
9
{
10
controller = HeathenEngineering.SteamworksIntegration.API.Input.Client.ConnectedControllers[0];
11
}
12
13
//...
14
15
private void Update()
16
{
17
SteamSettings.Client.UpdateAllActions(controller);
18
19
var actionData = someAction[controller];
20
if(actionData.active)
21
Debug.Log("Engaged: " + actionData.state);
22
}
23
}
Copied!
Once you have a script updating the status of your actions other behaviours can simply read that most recent state;
1
public class SomeOtherBehaviour : MonoBehaviour
2
{
3
Steamworks.InputHandle_t controller;
4
public InputAction otherAction;
5
6
// ...
7
8
private void Start()
9
{
10
controller = HeathenEngineering.SteamworksIntegration.API.Input.Client.ConnectedControllers[0];
11
}
12
13
// ...
14
15
private void Update()
16
{
17
var actionData = otherAction[controller];
18
if(actionData.active)
19
Debug.Log("Engaged: " + actionData.state);
20
}
21
}
Copied!

Update Status

1
public void UpdateStatus(InputHandle_t controller);
Copied!
Call this to update the state of the action for the indicated controller.

Example:

1
var controller = Input.Client.ConnectedControllers[0];
2
// ...
3
testAction.UpdateStatus(controller);
Copied!
You can optionally call this for all actions at once via the Steam Settings object
1
var controller = Input.Client.ConnectedControllers[0];
2
// ...
3
SteamSettings.Client.UpdateAllActions(controller);
Copied!

Get Input Glyphs

1
public Texture2D[] GetInputGlyphs(InputHandle_t controller, InputActionSet set);
Copied!
1
public Texture2D[] GetInputGlyphs(InputHandle_t controller, InputActionSetLayer set);
Copied!
1
public Texture2D[] GetInputGlyphs(InputHandle_t controller, InputactionSetHandle_t set);
Copied!
This returns the set of textures related to the action for the given controller and action set. For example if this action exists on the indicated set and is mapped to the B button and Right Trigger then the B button texture and RT texture will be returned.
The images for these can be configured in your app.

Examples:

1
var images = action.GetInputGlyphs(controller, actionSet);
2
// ...
3
rawImage.Texture = images[0];
Copied!

Get Input Names

1
public string[] GetInputNames(InputHandle_t controller, InputActionSet set);
Copied!
1
public string[] GetInputNames(InputHandle_t controller, InputActionSetLayer set);
Copied!
1
public string[] GetInputNames(InputHandle_t controller, InputactionSetHandle_t set);
Copied!
This returns the set of names related to the action for the given controller and action set. For example if this action exists on the indicated set and is mapped to B and Right Trigger then the string "B Button" and "Right Trigger" will be returned.

Examples:

1
var names = action.GetInputNames(controller, actionSet);
2
// ...
3
label.Text = names[0];
Copied!

How To

Create

Input Actions are created as part of your Steam Settings object

Set Analog or Digital

Click the AI or DI buttton to change the type
AI represents "Analog Input"
DI represents "Digital Input"