I’m making a repeat interaction, which triggers actions on a repeated interval. Currently my code looks like this:
#if UNITY_EDITOR
[UnityEditor.InitializeOnLoad]
#endif
class RepeatInteraction : IInputInteraction
{
public float RepeatDelay = 1f,
RepeatRate = .1f;
static RepeatInteraction()
{
InputSystem.RegisterInteraction<RepeatInteraction>();
}
public void Process(ref InputInteractionContext context)
{
Debug.Log($"phase: {context.phase} started: {context.isStarted} val: {context.ReadValue<float>()} val2: {context.action.ReadValue<float>()}");
if(!context.ControlIsActuated())
{
Debug.Log("Stop!");
context.Canceled();
} else if (context.timerHasExpired)
{
Debug.Log("Repeat");
context.Performed();
context.SetTimeout(RepeatRate);
return;
} else if (context.phase == InputActionPhase.Waiting)
{
Debug.Log("Delay");
context.PerformedAndStayStarted();
context.SetTimeout(RepeatDelay);
}
}
public void Reset()
{
}
}
It behaves as expected, when i poll isTriggered in my code it does indeed get set to true once its triggered, 1 second after its trigged, and 0.1 seconds after that while im still holding it.
However the code that consumes this read the value of a 1d axis, and ReadValue always returns 0 in repeats. Context.ReadValue does return the correct keydown value, i dont know how to pass through the correct value to the action.

The ‘phase:’ log comes from the interaction, we can see the first value which is read from the context is correct, the second from the action isnt. The code that uses the input logs triggered and the value, the first time it is correctly -1, but at repeats it returns 0. I would expect the same value -1 be read out from the control every time.
Its really confusing there are multiple readvalues in the first place, any help is greatly appreciated!