Input System - Filtering by Control Type or Scheme

Hello all!

I’ve recently started working on implementing the new Input System 1.3.0 into my game, in preparation for gamepad support and console porting.

While it’s been quite the learning experience, I’ve been pretty happy with the results so far and the ease of setting up new actions. However, I’ve reached a roadblock with Rebinding.

Previously, I was using a custom input manager I wrote, and the Input class had a variable tracking which control type it belonged to, and whether or not it should display in the rebinding menu (so that system controls like Mouse Look or Escape could be hidden and not rebindable), and this made it easy to iterate through all of the inputs and only display what I wanted.
I was able to get the iteration part of this working easily, to go through my action maps and generate a list of UI buttons for each control - however, this pulls EVERYTHING - keyboard, gamepad, and system controls I don’t want to rebind. Basically, I’m trying to figure out two things:

  1. Is there a way to designate that a certain action or binding should be hidden, aside from just manually building a list or putting some kind of string marker in the binding name?
  2. Is there a way to check which control scheme a binding belongs to? I’ve got my bindings assigned to schemes based on Keyboard vs. Gamepad, but I’m having trouble finding a way to check which device/scheme the input is intended for. If I could check that, I could easily filter these actions down.

Thanks in advance!

I wound up going with just building a custom class to extend the InputBinding class, that included bools for whether a control should be shown in the rebind menu, and whether you’re allowed to rebind it.

This might be something that’s worth adding to the current Input System - just a simple bool for each binding that can be set in the manager to determine whether it’s allowed to be rebound, and whether it should be displayed in a rebind screen. Use cases would be system controls like opening the menu, or arrow keys used to navigate the menus, which don’t need to be shown, or things like movement being on the left stick that you don’t want to be bindable.

For issue 2, I found you can access the “groups” property of an InputBinding to get string values for the control schemes it belongs to. I wound up doing this to check if a binding was gamepad or KB/M:

                foreach(InputBinding bind in input.bindings)
                {
                    if((bind.groups.Contains("Keyboard") && controlType==0) || (bind.groups.Contains("Gamepad") && controlType == 1))
                    {
                        displayedBinding = bind;
                        foundBind = true;
                    }
                }