Sign In Register

How can we help you today?

Start a new topic

Unity Hang up on Recompile

I've been having this problem since months and only happens when I have GameSparks sdk imported in a project, whenever I change a script and Unity starts recompiling while I'm playing the Unity freezes, I noticed that if I stop playing before few seconds nothing happens but if I wait too long then Unity freezes so I have close it an open it again.


6 people have this problem

I created a new project, imported the GameSparks SDK, and made a test script. Upon compilation, it froze the Unity Editor.


2 people like this

This is temporary solution.
Remove or comment out [InitializeOnLoadMethod] above GameSparksSettingsEditor::FixSDK() function.


2 people like this

This happens to me too with Unity 5.5.2p2 and GameSparks 5.5.4.66. It happens almost every other time I hit play.. very, very frustrating. :(


1 person likes this

Happens still in 5.6.3 -- I saw some tricks above about to try. Windows 10. Happens every other play test in editor. It's definitely a hair-ripper: I finally found this thread and realized it's GS. I am going to be so joyous if 1 of those 2 workarounds on page 2 works!


1 person likes this

Hello, Christopher.

Thanks for sharing your script, I've used something similar in my game and it works fine, and haven't seen any crashes since then.

I think the key factor here is waiting a bit after calling the shutdown function and before checking if GameSparks is no longer available, without this delay, the crash still happens sometimes.


1 person likes this

Hi Yaser,


No problem! I've been running smoothly since I put that script in. Seems to be working just fine thankfully.


I would agree about the key factor. Without the wait, Unity becomes unresponsive. I would have to kill Unity 9 times out of 10.


Thank you for verifying that what you did is similar and works out as well.


1 person likes this

Figured out what's happening here, but not sure how to fix it.

This is being caused by a network thread hanging. I use Gamesparks, and OnApplicationQuit I call GS.Disconnect(), which takes care of these threads normally.

However, if there's an error in the game, like an NPE, and I stop the game afterward, OnApplicationQuit won't get called, and this can cause Gamesparks network threads to hang and stay open.

@GameSparks Team I hope this info helps you to fix the error. 

It's impractical to develop in this condition. 




1 person likes this

Danish,


Would it be possible that when doing async operation with GameSparks, the game hangs ?

I didn't open a new thread thinking it could be on my side, and it might not be related to this topic, but often, when I send an update to GS (event), my game freezes for a few seconds (I send a request every 2-3s). The game doesn't freeze every time I send an event, but regularly.


Thanks.




1 person likes this

^ (Sorry, can't edit posts here)


An example of the Unity coroutine freeze is this:


IEnumerator _someCoroutine()

{

    while (waitingOnSteamToInit)

        yield return null; // or wait for a few seconds.

}


This isn't infinite, but it is waiting on Steam to initialize. If you stop playing before steam initializes (or don't have steam running and stop), it may freeze unity.


1 person likes this

Hello,


For Unity 5.6.0f3 and GameSparks SDK 5.5.4.66, I managed to find out that the problem seems to be with the PlatformBase script using OnApplicationQuit to disconnect from GameSparks. As it seems, OnApplicationQuit was not always being called when the Editor stopped playing. Therefore, the next time I tried to play from the Editor, it would freeze.


I fixed this issue by:

  1. Commenting the OnApplicationQuit method.
  2. Calling GS.Disconnect() at OnDestroy and commenting out the Update that was being called there, as follows:

virtual protected void OnDestroy () {
      //Update();
      GS.Disconnect();
      GS.ShutDown();
}

 After this change, the Unity Editor of our team has not frozen for a whole day.


Hope this helps you to further find the problem with the SDK.


Best regards,

Henrique


1 person likes this

Yeah, the same goes for me, without the wait, some times I will need to kill the unity process.

Good luck with your game!



1 person likes this

Hi Guys,


Yes the latest SDK had a change that addressed this issue. Glad to hear its working for you guys !


Regards,

Liam


1 person likes this

Hi Joseph,


Would you be able to confirm that this error doesn't appear if you repeat this process with a fresh unity project.


Kind regards,

 - Steve

@Kyungup Lim I think the [InitializeOnLoadMethod] problem was solved on a previous update, I also had problems with that but not anymore. 


My unity still freezes after recompile while playing so I got a script that stops playing whenever unity starts re-compiling.


I tried that fix from @Henrique Campos but didnt work for me.

Hi Guys,


Dylan has kindly tested a fix which has addressed this issue for him. It will be included in an upcoming SDK release. it should be available in the next week or so.


Regards,

Liam

Login to post a comment