- Home /
smartfoxserver keeps me logged in after exiting game
I'm building a game using Unity3D and connecting that to a Smart Fox Server. When I'm testing the game, I click play as usual, login to the Smart Fox Server, test, and then click play again to go back and edit. Problem is, Smart Fox Server is keeping me logged in after I click the play button again to stop the test, so when I go to login again I can't.. I have to wait for it to timeout. Is there a way to have Unity send a call to the smartfox server to log me out when I exit the game?
Answer by Molix · May 28, 2010 at 02:26 AM
I think you'll want something like:
void OnApplicationQuit()
{
UnsubscribeEvents(); // e.g. SFSEvent.onConnectionLost -= OnConnectionLost;
smartFoxClient.Disconnect();
}
OnApplicationQuit is called when the game exits, and in the editor when you stop playing.
I did that, but it's not working for me. Is there any need to do something in the server side?
You're calling Disconnect(), so that should be enough for the server. $$anonymous$$ake sure it is actually being called (e.g. add a debug command).