#Does Unity's New Input System operate at native level?

1 messages · Page 1 of 1 (latest)

hearty idol
#

Hi, I'm struggling finding information online, so I guessed I would ask here in case anyone knows.

Unity's New Input System InputAction.CallbackContext has a time parameter, which I assume it refers to the time the input was performed. However, what I can't seem to figure out by myself is if that time is bound to the update loop of the game (meaning the time at which the frame is rendered), or it is the actual time when the action was performed on the specific controller. My concern here is about input accuracy, since I would like to know if I can use that for a rhythm game.

frozen ibex
#

I'd say that the documentation is pretty explicit on the time property:

public double time { get; }
Time relative to Time.realtimeSinceStartup at which the action got triggered.

Remarks:
This is usually determined by the timestamp of the input event that activated a control bound to the action. What this means is that this is normally not the value of Time.realtimeSinceStartup when the input system calls the callback but rather the time at which the input was generated that triggered the action.
- Source: Unity Input System API Documentation

See also:
UnityEngine.InputSystem.LowLevel.InputEvent.time
Time.realTimeSinceStartup

Since it's using realtime and audio is bound to game time (i.e. it may lag), there may be some issues trying to use it for a rhythm game. But that's just my two cents.

hearty idol
#

Thanks for replying 🙂

I forgot to update when I found the answer, but basically I went with the LowLevel solution you mentioned.

InputSystem.onEvent gets invoked every time an input event is performed, not tied at all to the player loop, which is exactly what I wanted.

Now the challenge is for me to try and find In the documentation workflows In order to figure out how to filter specific input events.