In the Start function of the NetworkController.cs, I have this:
Code: Select all
void Start() {
Debug.Log("NetworkController: Start");
Application.runInBackground = true; // Let the application be running whyle the window is not active.
smartFoxClient = GetClient();
if (smartFoxClient==null) {
Application.LoadLevel("LoginScreen");
return;
}
SubscribeEvents();
started = true;
smartFoxClient.JoinRoom(Application.loadedLevelName);
Debug.Log("NetworkController: Finish");
}
And it works wonderful the first time I enter the room. I see all the other players, everything is fine.
Now, I go to a new scene from within the game. As I mentioned, I call "LeaveRoom" and I load the new scene.
This is the problem: OnJoinRoom will fire 2 times. If I go into another scene, it will fire 3 times, another scene, it will fire 4 times and so on for however many scenes I try and connect within the game.
It's almost like there is a counter following it. I have NO CLUE where to start looking to track this down. I thought to look into the ProcessEventQueue and maybe clear it out or something when a new scene is loaded but I don't even understand it's purpose let alone how to clear it out.
Any thoughts? I can provide the 2 scripts if anyone wants to look at them (the 2 scripts are the NetworkController and PlayerSpawnController from the SFSIslandDemo).
Thanks in advance.