How to get Vector2Composite direction name from binding?

Hello, I was wondering if it is possible to get the direction name (up, down, left, right) from Vector2 Composite. I’m making my own InputSystem handler, but I have to somehow get to the direction of the binding. Is it possible to get it by code at runtime?

The name of the part is stored in InputBinding.name. For the “Movement” action in your screenshot, there will be an InputBinding with isComposite==true and name==Direction and then four bindings with isPartOfComposite==true and “name” corresponding to one direction.

With the about-to-be-pushed 1.1-preview (slightly delayed but going through QA ATM) you’ll be able to go through this in code like so

var movement = playerInput.actions["Movement"];

var composite = movement.ChangeCompositeBinding("Direction");

var up = composite.NextPartBinding("Up");
var down = composite.NextPartBinding("Down");
var left = composite.NextPartBinding("Left");
var right = composite.NextPartBinding("Right");

Debug.Log($"Up is bound to {up.binding.path}");
Debug.Log($"Down is bound to {down.binding.path}");
Debug.Log($"Left is bound to {left.binding.path}");
Debug.Log($"Right is bound to {right.binding.path}");

Thank you! I did something like that and it works too.

string partString = string.Empty;
string bindingName = bindings[bindingIndex].name;
if (!string.IsNullOrEmpty(bindingName))
{
    NameAndParameters nameParameters = NameAndParameters.Parse(bindingName);
    partString = nameParameters.name;
}