action.GetBindingDisplayString not returning "Left" or "Right" for alt and shift

When doing my rebinding and displaying the current binding it is omitting the “Left” or “Right”.

I am using the following code:

displayString = action.GetBindingDisplayString(bindingIndex, out deviceLayoutName, out controlPath, _displayStringOptions);

When I debug the code you can see that internally it has the “Left Alt” but when “ToHumanReadableString” gets to the part:

var text = (options & HumanReadableStringOptions.UseShortNames) != 0 &&
  !string.IsNullOrEmpty(matchedControl.shortDisplayName)
  ? matchedControl.shortDisplayName
  : matchedControl.displayName;

The “matchedControl.displayName” only contains “Alt” for some reason.

Am I doing something wrong?

OK well not sure if that is a bug or not but I found a solution.

Use this:

displayString = InputControlPath.ToHumanReadableString(action.bindings[_bindingIndex].effectivePath, InputControlPath.HumanReadableStringOptions.OmitDevice);

in place of this:

displayString = action.GetBindingDisplayString(bindingIndex, out deviceLayoutName, out controlPath, _displayStringOptions);

in your “RebindActionUI”