RevenantX / LiteNetLib

Lite reliable UDP library for Mono and .NET
https://revenantx.github.io/LiteNetLib/index.html
MIT License
3k stars 489 forks source link

Replace UnitySocketFix with thread safe. #514

Closed FirstGearGames closed 1 year ago

FirstGearGames commented 1 year ago

This change replaces UnitySocketFix with PausedSocketFix, a thread safe and less complicated version.

UnitySocketFix would break when LiteNetLib was run on a thread since it's initialization involved creating a gameObject and adding a component.

PausedSocketFix uses thread safe events and a non-monobehaviour class. PausedSocketFix also brings enhancements to not drop the connection when the application loses focus, but rather only try to reconnect on focus gain if connection was lost.

FirstGearGames commented 1 year ago

Unity defines missing, fixing then starting new PR.