heroiclabs / nakama-unity

Unity client for Nakama server.
https://heroiclabs.com/docs/unity-client-guide
Other
411 stars 75 forks source link

KeyNotFound Exception #111

Closed zfand closed 3 years ago

zfand commented 3 years ago

Hi Nakama,

Our game is using Nakama Unity version 2.4.0 and we see the following exception:

KeyNotFoundException The given key was not present in the dictionary. 
    <00000000000000000000000000000000> System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item(TKey key)
    <00000000000000000000000000000000> Nakama.UnityWebRequestAdapter+<SendRequest>d__11.MoveNext()
    <00000000000000000000000000000000> UnityEngine.SetupCoroutine.InvokeMoveNext(System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress)

It looks like the culprit is this line.

Could you please update this function to check if the dictionary has the key before accessing it? Thank you!

lugehorsam commented 3 years ago

Thanks @zfand, we'll create a patch release on Github today with a fix.

lugehorsam commented 3 years ago

We've done a new release with this fix: https://github.com/heroiclabs/nakama-unity/releases/tag/v2.8.1

You can upgrade to it via an entry in your project's manifest.json:

"com.heroiclabs.nakama-unity": "https://github.com/heroiclabs/nakama-unity.git?path=/Packages/Nakama#v2.8.1"

lugehorsam commented 3 years ago

Edit: I've also included the .unitypackage as part of the release binaries.