Can't connect to SFS when creating my own new Unity project.

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Silverleaf
Posts: 2
Joined: 28 May 2017, 11:22

Can't connect to SFS when creating my own new Unity project.

Postby Silverleaf » 28 May 2017, 11:32

I downloaded all the example Unity projects for SFS and when I run those, they connect to the local host just fine.
Then, I created my own new Unity project, put the SFS .dll's in the proper Plugins folder, added a basic connection script (it works using pretty much the same exact code as the basic Connect tutorial) and everything compiles and runs fine in the new project.

However, when I call sfs.Connect(cfg) using the basic settings of 127.0.0.1 port 9933 (the default), none of my registered callback events ever get called, and sfs isn't connected as far as I can tell.

I cannot figure out why the demos are connecting for me just fine, but my new project version does not connect using the same code and settings, with the SmartFox2X.dll in the /Plugins folder.

My SmartFox object in script is completely valid at runtime and is found the .dll and imported all the symbols correctly so that I can call Connect().

It's just that when I do, no callbacks ever get called back. :(

What did I do wrong in the project setup?

I also made sure all the referenced SmartFox .dll platform setting completely match the setting as described in the docs and also made sure they were the same as the demo projects.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Can't connect to SFS when creating my own new Unity project.

Postby Lapo » 29 May 2017, 07:31

Hi,
can you show us the code you're using to start the connection and receive the events?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Silverleaf
Posts: 2
Joined: 28 May 2017, 11:22

Re: Can't connect to SFS when creating my own new Unity project.

Postby Silverleaf » 30 May 2017, 05:11

Thanks for the reply. I figured out my problem about 20 minutes after I posted. I couldn't update post though because it went to the 'verification' queue and wouldn't show me my post anymore for a while.

Anyway, the issue was because I forgot to add SFS->ProcessEvents() to my Update() method in C#. So I wasn't getting any events. Duh. :)
Although, I did read tutorials before hand and I don't remember them ever discussing ProcessEvents() and why it's needed. That just shows up in the C# examples and one must take note of it.

Thanks!
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Can't connect to SFS when creating my own new Unity project.

Postby Lapo » 30 May 2017, 07:55

No problem :)
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 104 guests