Page 1 of 1

Unable to reconnect on the same instance of SmartFox

Posted: 29 Oct 2014, 09:07
by paintbrush
Hi all,

I've played with SmartFox long ago, but recently decided to come back and try 2X.

I'm running into a problem when I attempt to connect again (by calling Connect()) on the same instance of SmartFox after an initial failed connection due to the absence of a running server. This is the stack trace I get:

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
Sfs2X.Bitswarm.BitSwarmClient.Connect (System.String ip, Int32 port)
Sfs2X.SmartFox.Connect (System.String host, Int32 port)
LoginScreen.Connect () (at Assets/Scripts/LoginScreen.cs:56)
LoginScreen.OnGUI () (at Assets/Scripts/LoginScreen.cs:40)
Creating a new SmartFox instance fixes this, but it'd be nice if I didn't have to. Is there a way around it?

Thanks for any help!
Jay

Re: Unable to reconnect on the same instance of SmartFox

Posted: 29 Oct 2014, 09:11
by Lapo
If a connection fails or the client gets disconnected you will need to recreate the main SmartFox object.

Cheers