Unable to reconnect on the same instance of SmartFox

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

Post Reply
paintbrush
Posts: 19
Joined: 06 Mar 2008, 07:12

Unable to reconnect on the same instance of SmartFox

Post 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
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unable to reconnect on the same instance of SmartFox

Post by Lapo »

If a connection fails or the client gets disconnected you will need to recreate the main SmartFox object.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply