Utility.SetAccessTokenForNetwork is being called in this network tutorial without any explanation why.
If I call the function twice with the same parameters ( called first for the server, and second for the client ), it throws an exception.
By the way, I’m trying to create an instance of the host and the client in the same executable for convenience’s sake.
My solution is to call Utility.GetAccessTokenForNetwork first, although of course there’s no docs for that either. Am I doing the right thing?
ArgumentException: An element with the same key already exists in the dictionary.
System.Collections.Generic.Dictionary2[UnityEngine.Networking.Types.NetworkID,UnityEngine.Networking.Types.NetworkAccessToken].Add (NetworkID key, UnityEngine.Networking.Types.NetworkAccessToken value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404) UnityEngine.Networking.Utility.SetAccessTokenForNetwork (NetworkID netId, UnityEngine.Networking.Types.NetworkAccessToken accessToken) (at C:/buildslave/unity/build/Runtime/Networking/Managed/UNETTypes.cs:119) NetworkTest6.SetToken (NetworkID netID, System.String tokenStr) (at Assets/Networking/NetworkTest6.cs:239) NetworkTest6.AttemptBecomeServer (UnityEngine.Networking.Match.CreateMatchResponse matchResponse, System.String& errors) (at Assets/Networking/NetworkTest6.cs:257) Host.OnMatchCreate (UnityEngine.Networking.Match.CreateMatchResponse matchResponse) (at Assets/Networking/Sandbox3.cs:50) UnityEngine.Networking.Match.NetworkMatch+<ProcessMatchResponse>c__Iterator0
1[UnityEngine.Networking.Match.CreateMatchResponse].MoveNext () (at C:/buildslave/unity/build/Runtime/Networking/Managed/MatchMakingClient.cs:302)