ROOM_JOIN event listener not working?

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

Moderators: Lapo, Bax

Super420
Posts: 6
Joined: 10 Jan 2017, 19:52

ROOM_JOIN event listener not working?

Postby Super420 » 10 Jan 2017, 19:55

So i am working on an online mmorpg with Unity and SFS2X for educational purposes, and i found out that it just straight up doesn't work for me.

Code: Select all

      sfs.AddEventListener(SFSEvent.ROOM_JOIN, OnJoinRoom);


Code: Select all

 void OnJoinRoom(BaseEvent e)
    {
        Debug.Log("Entered:" + e.Params["room"]);
    }


They very simple do not got executed, however when i check the control panel it certainly did enter the room?

I hope you guys can help me out, thanks :)
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: ROOM_JOIN event listener not working?

Postby Lapo » 11 Jan 2017, 09:22

Hi,
the event will trigger when the client joins a Room, are you sending a JoinRoomRequest?

Also I would highly recommend to check for server side errors, maybe there's something else going on.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Super420
Posts: 6
Joined: 10 Jan 2017, 19:52

Re: ROOM_JOIN event listener not working?

Postby Super420 » 15 Jan 2017, 20:40

Lapo wrote:Hi,
the event will trigger when the client joins a Room, are you sending a JoinRoomRequest?

Also I would highly recommend to check for server side errors, maybe there's something else going on.

Thanks


I am indeed using a JoinRoomRequest, serverside doesn't give me an error.
When i set

Code: Select all

sfs.ThreadSafeMode = true;
to

Code: Select all

sfs.ThreadSafeMode = false;
it works.
Very strange.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: ROOM_JOIN event listener not working?

Postby Lapo » 16 Jan 2017, 09:02

Hmmm... that can't be right.
In Unity you don't need to change the value of ThreadSafeMode, if you do the API no longer work. The flag is there only for other platforms, outside of Unity.

Are you calling the SFS.ProcessEvent() in your Update() method?

If you're not sure about this please make sure to read this simple tutorial:
http://docs2x.smartfoxserver.com/Exampl ... /connector

If there's anything else, let us know.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Super420
Posts: 6
Joined: 10 Jan 2017, 19:52

Re: ROOM_JOIN event listener not working?

Postby Super420 » 20 Jan 2017, 22:39

Lapo wrote:Post by Lapo » 16 Jan 2017, 10:02


It's very strange indeed, i've somehow gotten it to work with

Code: Select all

ThreadSafeMode = true

But right i now i have this issue, i made a function for joining a room, however server does not process it at all :


Code: Select all

   void JoinPool() {
      sfs.Send (new JoinRoomRequest (Pool));
      SceneManager.LoadSceneAsync ("Pool");
   }


That should just work right? :?:
Super420
Posts: 6
Joined: 10 Jan 2017, 19:52

Re: ROOM_JOIN event listener not working?

Postby Super420 » 29 Jan 2017, 15:02

Haha, i was being dumb. Sorry. I had used the connection script in multiple classes and i used the wrong one. Now it works. Sorry for everything :oops:

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 28 guests