colyseus / colyseus-unity-sdk

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

Fix schema mismatch exception #179

Closed Xaverix closed 2 years ago

Xaverix commented 2 years ago

In case of schema mismatch the ConsumeSeatReservation Task was stuck forever. This is because the OnError callback which would complete the task was never called. Also the player is still in the room but unable to do anything.

Those commits are a simple fix, now the schema mismatch exception will be thrown and player will automatically leave the room.

endel commented 2 years ago

Thanks a lot for your PR @Xaverix!

I don't think we have the ErrorCode's ported over for C#, I think it would be relevant to bring the ErrorCode constants from other clients, and add a new constant code for schema-mismatch instead of 0:

For reference, here's the ErrorCode constants in TypeScript: https://github.com/colyseus/colyseus.js/blob/9b9b71850631936c504c852b1bd369a762eab1a4/src/Protocol.ts#L15-L24

Xaverix commented 2 years ago

Thanks for suggestion @endel, I have added the error codes.

endel commented 2 years ago

Looking great, thank you so much @Xaverix! 🎉