InControl: Bindings FAQ

How can I detect whether keyboard or controller input was used on bindings?

There is a LastInputType property on both PlayerActionSet and PlayerAction which you can query for this purpose. It returns one of the BindingSourceType enum:

if (actions.LastInputType == BindingSourceType.KeyBindingSource)
{
    ShowKeyboardControls();
}
else
if (actions.LastInputType == BindingSourceType.DeviceBindingSource)
{
    ShowControllerControls();
}

Additionally PlayerActionSet and PlayerAction also have an event callback you can use if you only want to be notified when it changes:

public event Action<BindingSourceType> OnLastInputTypeChanged;

How can I get to the actual keys on a keyboard binding?

foreach (var binding in action.Bindings)
{
    var keyBindingSource = binding as KeyBindingSource;
    if (keyBindingSource != null)
    {
        var keyCombo = keyBindingSource.Control;
        for (var keyIndex = 0; keyIndex < keyCombo.IncludeCount; keyIndex++)
        {
            var key = keyCombo.GetInclude( keyIndex ); // returns enum Key
            var keyName = InputManager.KeyboardProvider.GetNameForKey( key );
            Debug.Log( keyName );
        }
    }
}