Not sure if this error is somehow TNet related as TNet does pop up in the error log. I apologize if it isn't and posting here.
I finally have my lobby working flawlessly... in the editor. Whether hosting or connecting to a built client, the editor always works perfectly without errors. When I build out a client, it never matches what running in the editor sees, whether hosting or connecting. The host for example, always show up in slot two instead of slot one like its supposed to. When switching teams from that slot, they go to slot 9, instead of the first open slot on the other team, slot 5. But all of this works and is shown correctly in the editor.
At first I thought maybe it was a network sync problem but when I put in a bunch of debugging things, everything was checking out. The arrays were in the correct order and length, ID's were where they should be. Nothing seemed wrong.
Well today, I finally ticked the script debugging box on building out my clients to test with. Sure enough, errors pop up that do not happen within the editor. Namely the one in the image. This error pops up as soon as you host a game when on a built client but not when running it in the editor.
Line 25 that is listed in the code is part of this code:
void OnNetworkJoinChannel (bool result, string message) {
if(result) {
if(TNManager.isHosting) {
playersID
= new int[maxPlayersSize
]; playersTeam
= new int[maxPlayersSize
]; playersReady
= new bool[maxPlayersSize
]; playersID[0] = TNManager.hostID; //This is line 25.
halfSize = maxPlayersSize/2;
InitializePlayerNameList();
//PrintPlayerIDList();
}
else
tno.Send("RequestUpdate", Target.Host, TNManager.playerID);
mRebuild = true;
}
}
maxPlayersSize is fed to this script before the arrays are initialized to make sure their size is correct. Even if I predefine the list to be 10 in size within the editor, I still get an array index error.