1
\$\begingroup\$

In the new input system of Unity, the function AddBinding gets a string as an input. In this link there are several examples, such as "<Mouse>/delta" or "<Keyboard>/alt". Often, I need to add a binding and I do not know what string to use. Where can I find a reference including all possible strings that can be used as an input?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

I'd recommend creating an InputAction in the Unity editor, then you can peek at what binding string is associated with any binding you can create in the UI:

Example inspector view

public class BindingInspector : MonoBehaviour
{
    public InputAction action;

    [TextArea(3,8)]
    public string binding;

    void Start() {
        if (action == null) {
            binding = "No action configured.";
            return;
        }
        string text = "";
        foreach (var binding in action.bindings) {
            text += $"{binding.ToString()}\n";
        }
        if (text == "") text = "No bindings configured.";
        binding = text;
    }
}
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .