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.
Can't connect to SFS when creating my own new Unity project.
-
- Posts: 2
- Joined: 28 May 2017, 11:22
Re: Can't connect to SFS when creating my own new Unity project.
Hi,
can you show us the code you're using to start the connection and receive the events?
Thanks
can you show us the code you're using to start the connection and receive the events?
Thanks
-
- Posts: 2
- Joined: 28 May 2017, 11:22
Re: Can't connect to SFS when creating my own new Unity project.
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!
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!
Who is online
Users browsing this forum: No registered users and 121 guests