colyseus / colyseus-unity-sdk

⚔ Colyseus Multiplayer SDK for Unity
https://docs.colyseus.io/getting-started/unity-sdk/
MIT License
371 stars 102 forks source link

prevent properties from being stripped out of WebGL builds. #173

Closed endel closed 2 years ago

endel commented 3 years ago

This issue has been reported recently. Happening only on WebGL builds.

OverflowException: Value was either too large or too small for an Int32.
  at System.Convert.ToInt32 (System.Double value) [0x00000] in <00000000000000000000000000000000>:0 

After inspecting, it has been found out that the error happened during schema serializer's Handshake, where fieldsByIndex did not contain one of the fields defined via [Type()] annotation:

https://github.com/colyseus/colyseus-unity3d/blob/f80f7f402ad2e51c4ebad59db389c0b4d05ee1ad/Assets/Colyseus/Runtime/Scripts/Serializer/Schema/Schema.cs#L430

This PR fixes the issue.