Page 1 of 1

Unity Editor freezes everytime when connect to server.

Posted: 11 Nov 2012, 07:03
by balder
The Unity Editor freezes every time when we use the MonoDevelop to debug the sample ObjectMovement.
Here,I create a simple project , new a SmartFox object and Connect to the server.
First time ,It's ok. Then i restart the scene in the Unity,The Unity Editor will freeze .

The code is very simple ,
smartFox = new SmartFox(false);
smartFox.Connect("127.0.0.1",9933);

The SmartFox2x Version is 2.3.0
The Unity sdk version is the Version 1.0.5
The Unity Version is 3.5.5f3

Re: Unity Editor freezes everytime when connect to server.

Posted: 12 Nov 2012, 02:20
by wren
I have exactly the same issue, even without MonoDevelop debugging. I guess it may have nothing to do with connect. Perhaps something is not closed properly when you stop the scene. I tried disconnect upon the application quit callback. Doesn't help.

Re: Unity Editor freezes everytime when connect to server.

Posted: 12 Nov 2012, 03:43
by balder
wren wrote:I have exactly the same issue, even without MonoDevelop debugging. I guess it may have nothing to do with connect. Perhaps something is not closed properly when you stop the scene. I tried disconnect upon the application quit callback. Doesn't help.

In the windows xp , the Unity with MonoDevelop Attached will Crash Immediately when connect the sever second time.

Re: Unity Editor freezes everytime when connect to server.

Posted: 12 Nov 2012, 04:46
by balder
In the release notes :
Version 1.0.2
[FIX] Unity editor hanging due to thread termination not always being detected by latest version of Mono implemented by Unity.
Is that the Unity crash problem?

My client sdk is the lastest version 1.0.5 ,and the sample is the ObjectMovement.

Re: Unity Editor freezes everytime when connect to server.

Posted: 14 Nov 2012, 11:27
by Lapo
I run Unity 3.5.6f4 on Mac at the moment; i don't see any particular crashes.
Also I am not sure exactly what you are referring to when you say SDK version 1.0.5. Shouldn't this match the Unity version?

Can you clarify which Unity Editor version do you use and which platform?

Thanks

Re: Unity Editor freezes everytime when connect to server.

Posted: 14 Nov 2012, 13:04
by balder
Lapo wrote:I run Unity 3.5.6f4 on Mac at the moment; i don't see any particular crashes.
Also I am not sure exactly what you are referring to when you say SDK version 1.0.5. Shouldn't this match the Unity version?

Can you clarify which Unity Editor version do you use and which platform?

Thanks

It's wired. Did you attach the Unity Process by MonoDevelop? When not attached , It's Ok. But ,when MonoDevelop attached in mac,the MonoDevelop paused ,and throw a exception ,says the vm is not suspended.

The version 1.0.5 is the smartfoxserver Unity client sdk's version. Can you ran in Windows? Unity freezes when MonoDevelop attached ,in windows.
When i press the play button in Unity at first time, It's ok.Then i stop the example, and press the play button. The Unity freezes.

I found in Unity4.0 beta 1 ,It's ok.

Re: Unity Editor freezes everytime when connect to server.

Posted: 14 Nov 2012, 13:51
by Lapo
I forwarded your request to ThomasLund so that he can take a look, he knows Unity much better than I do.
stay tuned.

Re: Unity Editor freezes everytime when connect to server.

Posted: 14 Nov 2012, 14:05
by balder
thanks.

Re: Unity Editor freezes everytime when connect to server.

Posted: 25 Nov 2012, 16:56
by ThomasLund
Sorry for the delayed answer.

We are not using the MD debugger here (for mostly historical reasons of it not having been supported earlier and MD sucking really bad).

So I cannot give you any good hints of what could be wrong and how to fix it.

But generally Unity editor does not release resources when stopping a play (e.g. statics that linger around or reloading external plugins).

Are you 110% certain your OnApplicationQuit is being called? And that it does something similar to:

if (SmartFoxClient!=null) SmartFoxClient.Disconnect();

Also make certain that your FixedUpdate has a failsafe check for a null client

void FixedUpdate() {
if (SmartFoxClient!=null) {
SmartFoxClient.ProcessEvents();
}

Generally there are LOTS of posts about MD debugging crashing Unity (also non-SFS related posts). One with a few hints and a link to a patch from Microsoft:
http://answers.unity3d.com/questions/62 ... evelo.html

So as such there might be tons of reasons why MD/Unity crashes, and off the bat I am uncertain if its SFS related or not.

Sorry for not being able to be more helpful on this issue. Will try to give MD debugging a new chance soon.

Edit:
Seems there is a lot of this going on. Some people on the forums around report this issue also in totally straight forward Unity projects without external dlls. What they report as "safe" is to attach the debugger only after starting the game. Else the debugger crashes Unity. So definitely sounds like a Unity/MD issue that I cannot solve. Also apply the Microsoft patch if you are on Windows - seems that solves it for some people permanently!

/Thomas

Re: Unity Editor freezes everytime when connect to server.

Posted: 28 Nov 2012, 11:04
by balder
Thanks very much.
When i update to the latested unity version 4.0, It's ok. Seems it's Unity 's bug.
ThomasLund wrote:Sorry for the delayed answer.

We are not using the MD debugger here (for mostly historical reasons of it not having been supported earlier and MD sucking really bad).

So I cannot give you any good hints of what could be wrong and how to fix it.

But generally Unity editor does not release resources when stopping a play (e.g. statics that linger around or reloading external plugins).

Are you 110% certain your OnApplicationQuit is being called? And that it does something similar to:

if (SmartFoxClient!=null) SmartFoxClient.Disconnect();

Also make certain that your FixedUpdate has a failsafe check for a null client

void FixedUpdate() {
if (SmartFoxClient!=null) {
SmartFoxClient.ProcessEvents();
}

Generally there are LOTS of posts about MD debugging crashing Unity (also non-SFS related posts). One with a few hints and a link to a patch from Microsoft:
http://answers.unity3d.com/questions/62 ... evelo.html

So as such there might be tons of reasons why MD/Unity crashes, and off the bat I am uncertain if its SFS related or not.

Sorry for not being able to be more helpful on this issue. Will try to give MD debugging a new chance soon.

Edit:
Seems there is a lot of this going on. Some people on the forums around report this issue also in totally straight forward Unity projects without external dlls. What they report as "safe" is to attach the debugger only after starting the game. Else the debugger crashes Unity. So definitely sounds like a Unity/MD issue that I cannot solve. Also apply the Microsoft patch if you are on Windows - seems that solves it for some people permanently!

/Thomas

Re: Unity Editor freezes everytime when connect to server.

Posted: 28 Nov 2012, 17:11
by ThomasLund
Great - happy it was easily solved