Unity client freezes when disconnected by server.

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

Moderators: Lapo, Bax

tichfuie
Posts: 26
Joined: 28 Aug 2012, 21:53

Re: Unity client freezes when disconnected by server.

Postby tichfuie » 16 Apr 2013, 15:46

thanks for following and tracking the issue,

in my case both the editor and standalone .exe windows app crashes/freezes too when server is disconnected.
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unity client freezes when disconnected by server.

Postby Lapo » 19 Apr 2013, 10:00

UPDATE: I've done a little more testing on this issue and I think that there's an effective workaround, which is to properly handle the quit event via the Unity OnApplicationQuit method, which is called right before the Editor (or WebPlayer) is stopped/closed.

I've tested the Lobby example we provide by adding this code:

Code: Select all

void OnApplicationQuit()
{
   if (smartFox.IsConnected)
      smartFox.Disconnect()
}


and it seems to be working correctly in the Editor, using Windows 8.
Give it a try and let us know if it solves the issue.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: Unity client freezes when disconnected by server.

Postby vkalpias » 19 Apr 2013, 10:28

Hi,

We were already doing this before as I've seen the related post, and it doesn't help unfortunately..
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unity client freezes when disconnected by server.

Postby Lapo » 19 Apr 2013, 13:07

If this is the case there should be something else going on.

I finished testing our Lobby example adding the OnApplicationQuit() code and exported to a native binary under Windows 8 and Windows 7 64bit and they all work as expected, with no errors or application hangs etc...

At this point my suspect is that there might be something else going on in your application that causes the issue.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: Unity client freezes when disconnected by server.

Postby vkalpias » 19 Apr 2013, 13:13

May I ask what exactly is the scenario that you are testing? Just to recap this is our scenario:

- Connect to the server
- Login to a zone
- Kill the server
- Quit the Unity application in the Editor
- Attempt to Start the Unity application in the Editor
- Editor hangs
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unity client freezes when disconnected by server.

Postby Lapo » 19 Apr 2013, 13:26

Yes, exactly same scenario.
Tested right now using Unity Editor 4.1.2, under Win7-64 and Win8. Works without hanging.
Lapo

--

gotoAndPlay()

...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: Unity client freezes when disconnected by server.

Postby vkalpias » 19 Apr 2013, 13:28

Hmmm.. This is going to be really hard to track down..
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unity client freezes when disconnected by server.

Postby Lapo » 19 Apr 2013, 13:37

Unfortunately yes :(
There could be something else in your code that is causing the the issue.
Lapo

--

gotoAndPlay()

...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: Unity client freezes when disconnected by server.

Postby vkalpias » 19 Apr 2013, 14:04

Sooo I think I know what's wrong. At some point you mentioned that this might be a UDP issue. And indeed, I am no longer calling InitUDP when I initialize the server and the problem disappears... Of course we need UDP for our game so we can't stop using it but this seems to be the issue.

You mentioned that the Lobby example works, however the Lobby example does not use UDP. Perhaps you could try an example that does?
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unity client freezes when disconnected by server.

Postby Lapo » 19 Apr 2013, 14:58

I have added UDP to the Lobby Example to make the full test and I have no problems with it as well.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 20 guests