colyseus / colyseus-unity-sdk

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

I find bug with FossilDeltaSerializer.. #108

Closed NakOh closed 4 years ago

NakOh commented 4 years ago

colyseus-unity3d/Assets/Plugins/Colyseus/Serializer/FossilDeltaSerializer.cs

public void SetState (byte[] encodedState, int offset) { State.Set (MsgPack.Deserialize<IndexedDictionary<string, object>> (new MemoryStream ( ArrayUtils.SubArray (encodedState, offset, encodedState.Length - 1) ))); // previousState = encodedState; -> Fixed it! previousState = ArrayUtils.SubArray (encodedState, offset, encodedState.Length - 1); }

Debugging took about 10 hours ...

I had to use FossilDeltaSerializer.

endel commented 4 years ago

Thanks @NakOh, I've applied a similar fix here: https://github.com/colyseus/colyseus-unity3d/blob/master/Assets/Plugins/Colyseus/Serializer/FossilDeltaSerializer.cs