InputAction.performed behaves differently [Solved]

So here are my setup, I have a Vector3 input and a float input.

Thing is, the Vector3 input performed when I press the key and release the key, so that I’m updated with 0,0,1 and 0,0,0 value.

But the float input only updates me when I press the button, and I would like it to perform a 0 when I release the key.
5395668--547386--demo.gif

FYI this is the Vector3 composite class I created.

[InitializeOnLoad]
public class Vector3Composite : InputBindingComposite<Vector3>
{
    [InputControl(layout = "Button")] public int forward = 0;
    [InputControl(layout = "Button")] public int backward = 0;
    [InputControl(layout = "Button")] public int left = 0;
    [InputControl(layout = "Button")] public int right = 0;
    [InputControl(layout = "Button")] public int up = 0;
    [InputControl(layout = "Button")] public int down = 0;

    public override Vector3 ReadValue(ref InputBindingCompositeContext context)
    {
        bool forwardIsPressed = context.ReadValueAsButton(forward);
        bool backwardIsPressed = context.ReadValueAsButton(backward);
        bool leftIsPressed = context.ReadValueAsButton(left);
        bool rightIsPressed = context.ReadValueAsButton(right);
        bool upIsPressed = context.ReadValueAsButton(up);
        bool downIsPressed = context.ReadValueAsButton(down);

        Vector3 result = Vector3.zero;
        result.x = rightIsPressed ? 1 : (leftIsPressed ? -1 : 0);
        result.y = upIsPressed ? 1 : (downIsPressed ? -1 : 0);
        result.z = forwardIsPressed ? 1 : (backwardIsPressed ? -1 : 0);

        return result;
    }
   
    static Vector3Composite()
    {
        InputSystem.RegisterBindingComposite<Vector3Composite>();
    }

    [RuntimeInitializeOnLoadMethod]
    static void Init() {} // Trigger static constructor.
   
}

OK so seems I figured this out on my own.

The first thing I noticed is that the Action(ThreeDCompositeInput) using Vector3Composite - the composite method I write myself - is always at performed phrase, after I “actuated” the action(press the corresponding key once).

And I read about the Default Interaction to figure out why it’s always in performed phrase. It turns out how the bound control is involved here. So I just added the other override method in my Vector3Composite class, to solve the issue.

public override float EvaluateMagnitude(ref InputBindingCompositeContext context)
{
    return ReadValue(ref context).magnitude;
}

Now it seems right just like the built-in binding: stays at started stage, and only go to performed whenever I press the key.