Alright, another issue that I caught:
[TNet] Trying to execute a function 'SetGameMode' on TNObject #1 before it has been created.
UnityEngine.Debug:LogWarning(Object)
TNObject:FindAndExecute(UInt32, String, Object[]) (at Assets/TNet/Client/TNObject.cs:399)
TNManager:OnForwardedPacket(BinaryReader) (at Assets/TNet/Client/TNManager.cs:1089)
TNet.GameClient:ProcessPacket(Buffer, IPEndPoint) (at Assets/TNet/Client/TNGameClient.cs:817)
TNet.GameClient:ProcessPackets() (at Assets/TNet/Client/TNGameClient.cs:747)
TNManager:Update() (at Assets/TNet/Client/TNManager.cs:1113)
This error pops up when you go to join a game in progress. When the player has input the IP address of the server they want to connect to, I load a level loading scene which has a script that takes the IP Address, connects to it and handles the channel joining. When the channel is joined, the script spawns two objects:
- In-game UI: uGUI HUD, Scoreboard, etc.
- NetworkManagement "Super" GameObject: This handles server and client code. This is TNObject #1
After it spawns them, the script that does the Network join and such kills itself and then those errors occur.
On the host, the host fires them as soon as the client joins inside OnNetworkPlayerJoin(). On the client, the client is
still loading the map, which has a lot of objects. I am getting the impression that this is the wrong call to use, because in my case, we're joining the channel and the server is firing the commands to the object that hasn't been spawned yet, hence the error.
Should I instead send a RFC to the host (ie. GetGameConfiguration() ) and let it tell the client what's happening when the client is ready to go?