FirstGearGames / FishNet

FishNet: Unity Networking Evolved.
Other
1.38k stars 149 forks source link

TimeManager TickToLocalTick and LocalTickToTick uint overflow bug #736

Closed SimEof closed 3 months ago

SimEof commented 3 months ago

General Unity version: 2022.3.21f1 Fish-Networking version: 4.3.8R PRO Discord link: https://discordapp.com/channels/424284635074134018/1034477094731784302/1257643529841152162

Description TimeManager TickToLocalTick and LocalTickToTick has a uint overflow bug when passing future ticks

Replication Steps to reproduce the behavior: Use any of demo scenes; Create and add new test script on player network object; In OnStartNetwork event Try to use TickToLocalTick(TimeManager.Tick + 1) or LocalTickToTick(TimeManager.LocalTick + 1) The calculated difference in these methods are never negative and 0 is returned

Expected behavior Future tick should be returned or the should be informed with either exception or in methods description

Screenshots image

FirstGearGames commented 3 months ago

Shouldn't be possible to overflow given the checks but it would return current localTick rather than localTick + correct-difference. I meant to make this change in 4.3.8 but didn't get around to it, it's even in my todo. I'll make sure it's added in right now.

SimEof commented 3 months ago

I understand. Thanks

FirstGearGames commented 3 months ago

Methods can now return future ticks in 4.4.0.