Unity Editor freezes everytime when connect to server.

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

Moderators: Lapo, Bax

balder
Posts: 13
Joined: 10 Nov 2012, 03:36

Unity Editor freezes everytime when connect to server.

Postby balder » 11 Nov 2012, 07:03

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
wren
Posts: 6
Joined: 05 Nov 2012, 06:57

Re: Unity Editor freezes everytime when connect to server.

Postby wren » 12 Nov 2012, 02:20

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.
balder
Posts: 13
Joined: 10 Nov 2012, 03:36

Re: Unity Editor freezes everytime when connect to server.

Postby balder » 12 Nov 2012, 03:43

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.
balder
Posts: 13
Joined: 10 Nov 2012, 03:36

Re: Unity Editor freezes everytime when connect to server.

Postby balder » 12 Nov 2012, 04:46

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.
User avatar
Lapo
Site Admin
Posts: 21119
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unity Editor freezes everytime when connect to server.

Postby Lapo » 14 Nov 2012, 11:27

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
Lapo
--
gotoAndPlay()
...addicted to flash games
balder
Posts: 13
Joined: 10 Nov 2012, 03:36

Re: Unity Editor freezes everytime when connect to server.

Postby balder » 14 Nov 2012, 13:04

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.
User avatar
Lapo
Site Admin
Posts: 21119
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unity Editor freezes everytime when connect to server.

Postby Lapo » 14 Nov 2012, 13:51

I forwarded your request to ThomasLund so that he can take a look, he knows Unity much better than I do.
stay tuned.
Lapo

--

gotoAndPlay()

...addicted to flash games
balder
Posts: 13
Joined: 10 Nov 2012, 03:36

Re: Unity Editor freezes everytime when connect to server.

Postby balder » 14 Nov 2012, 14:05

thanks.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Re: Unity Editor freezes everytime when connect to server.

Postby ThomasLund » 25 Nov 2012, 16:56

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
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
balder
Posts: 13
Joined: 10 Nov 2012, 03:36

Re: Unity Editor freezes everytime when connect to server.

Postby balder » 28 Nov 2012, 11:04

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
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Re: Unity Editor freezes everytime when connect to server.

Postby ThomasLund » 28 Nov 2012, 17:11

Great - happy it was easily solved
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 4 guests