Surprised CallbackContext.duration is always 0 for Button action

Hi,

Maybe I am missing something here, but I just realized the CallbackContext.duration value is always 0 for my simple left click button action, because startTime and time are identical.

That makes these value less useful for my case: I would like to figure out how long a button had been held. There are many other ways (like using Hold interactions), but I thought it is intuitive to extract this info from Input System as it already need to know these values.

I am getting this value from a PlayerInput with Unity Event, I wonder if I need to use another method?

Thx

I stumbled across this thread as I had the same issue. Maybe it's a little bit too late, but could be helpful to someone else. For me the solution was to go to the InputActions-Map and add the "Hold"-interaction as a property of the Action you want to get the duration of.

1 Like