I have just started learning TNet and I'm encountering a strange issue with TNAutoJoin that was used in the second TNet tutorial and in an example scene. Any attempt to start the game is interrupted by the following error:
Exception has been thrown by the target of an invocation. (TNAutoJoin.OnNetworkConnect)
UnityEngine.Debug:LogError(Object, Object)
TNet.UnityTools:Broadcast(String, Object[]) (at Assets/TNet/Client/TNUnityTools.cs:216)
TNManager:OnConnect(Boolean, String) (at Assets/TNet/Client/TNManager.cs:977)
TNet.GameClient:ProcessPacket(Buffer, IPEndPoint) (at Assets/TNet/Client/TNGameClient.cs:665)
TNet.GameClient:ProcessPackets() (at Assets/TNet/Client/TNGameClient.cs:633)
TNManager:Update() (at Assets/TNet/Client/TNManager.cs:962)
The server logs the connection, though. I've tried checking a few options like changing IP and ports of the server in the server config and TNAutoJoin inspector, but those parameters don't seem to be related to the issue. What else could be happening and is there a way to make the "Exception has been thrown by the target of an invocation." error more informative? (I've seen lots of very varied cases on the net mentioning it, none applying to the situation as far as I see, so it might be a generic error covering very broad amount of potential reasons)
Update: Rechecked it on an empty project, the error is not happening, so it's most likely down to differences in TNAutoJoin public parameters I was attempting to use. The question about making "Exception" error more informative still stands though, as I'm pretty much in the blind about the cause.
Update2: Reimporting TNet somehow fixed the issue, examples now open even in the current project. Not sure if issue is related or not, but I'm now getting a strange error in the server log that doesn't seem to affect the connection:
127.0.0.1:3806 has connected
The requested address
is not valid
in its context
.
This happens on every single connection I make with the server and a client situated on the same PC.