Search Unity

Question Is it possible to grab the control binding path for a referenced action?

Discussion in 'Input System' started by Roryyyyyyyyyy, Nov 30, 2023.

  1. Roryyyyyyyyyy

    Roryyyyyyyyyy

    Joined:
    Jun 8, 2015
    Posts:
    22
    I am working on a lookup system to pair the control binding path to a glyph sprite. I've got a way to dump out all possible binding paths (<gamepad>/dpad/up, etc), but for the life of me can't work out how to check that from an InputActionReference.

    I want to make a simple UI element where I can drag a reference to a specific action and that will be reactive to when the input device updates and when the binding is changed. The samples say to use the action.GetBindingDisplayString() to use as the lookup key but this is different for various devices, and I so far haven't managed to find how to dump out a full list of all possible display strings, so if that is something that is possible I'm open to that idea, but the path strings seem the most reliable as they aren't device specific (X or A can be referenced as button south etc)

    Also, would InputActionReference be the best route for this? Or are there easier ways to reference actions in the inspector?

    Thanks in advance.