I’m trying to make a system where I can display all of the buttons from an InputActionMap on the screen
string controlName = control.GetBindingDisplayString();
Debug.Log($"{control.name} {controlName}");
if (control.bindings[0].isComposite) controlName = control.bindings[0].name;
buttonHint.GetComponent<TextMeshProUGUI>().text = $"<b>{control.name}</b> - {controlName}";
“control” is of type InputAction. And, well:
You can see here that “Engage” and “Enter Command-Mode” will return an empty string
Any clues as to why?
EDIT: This code seems to give me the results I was looking for:
string controlName = control.bindings.FirstOrDefault().ToDisplayString();
if (control.bindings.FirstOrDefault().isComposite) controlName = control.bindings.FirstOrDefault().name;
buttonHint.GetComponent<TextMeshProUGUI>().text = $"<b>{control.name}</b> - {controlName}";
That being said, what described in the post may still be a bug and if that is the case I hope it finds the devs’ attention.



