Skip to content

Fix event timestamps not aligning to actual realtime#48

Open
TheNathannator wants to merge 1 commit intokeijiro:masterfrom
TheNathannator:timestamp-fix
Open

Fix event timestamps not aligning to actual realtime#48
TheNathannator wants to merge 1 commit intokeijiro:masterfrom
TheNathannator:timestamp-fix

Conversation

@TheNathannator
Copy link

In the editor, the input system uses an internal time offset which is adjusted whenever play mode is entered or exited. This offset is used to make the 0 point of input timestamps match the time at which the last play mode transition happened.

The current method of grabbing input time bypasses this offset by using reflection to access an internal property. Without this offset, timestamps will never be in sync while in the editor, and will continually drift more and more each time play mode is entered.

wrong.timestamps.mp4

The publicly-accessible InputState.currentTime property accounts for this offset, and so do the InputSystem.Queue*Event family of functions. Using that instead fixes this issue.

fixed.timestamps.mp4

In the editor, the input system uses an internal time offset which is adjusted whenever play mode is entered or exited. This offset is used to make the 0 point of input timestamps match the time at which the last play mode transition happened.

The current method of grabbing input time bypasses this offset by using reflection to access an internal property. Without this offset, timestamps will never be in sync while in the editor, and will continually drift more and more each time play mode is entered.

The publicly-accessible `InputState.currentTime` property accounts for this offset, and so do the `InputSystem.Queue*Event` family of functions. Using that instead fixes this issue.
@keijiro keijiro self-assigned this Nov 14, 2025
@keijiro keijiro added the enhancement New feature or request label Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants