Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Unity 5.6.1p1 freezes on play without error

Discussion in 'Editor & General Support' started by Agaw, May 31, 2017.

  1. Agaw

    Agaw

    Joined:
    Jan 26, 2017
    Posts:
    1
    Dear Unity community!

    I am currently baffled at an issue causing my Unity Editor to freeze without warning, normally when I try to run a scene.
    The last two lines in my log file (no errors are logged) are :
    Then it just freezes without ever unfreezing (had it run in the background for >1hr once).

    About my setup:
    Windows 10 - 64bit
    Processor : i7
    Ram: 32Gb
    Graphic card: Nvidia geforce GTX970
    Unity: 5.6.1p

    I think that it freezes more often when I have chrome running.
    Other than that I am not sure how to proceed troubleshooting the problem. Any advice or ideas welcome!
    Thanks!

    UPDATE: It seems a similar issue has been discussed here (https://forum.unity3d.com/threads/unity-randomly-freezes.415543/) with no clear answer given.
     
    Last edited: May 31, 2017
  2. Stroved

    Stroved

    Joined:
    Jan 3, 2014
    Posts:
    15
    I've also been seeing this issue. It happens on play and when just in the editor. I have to kill the process in task manager and restart Unity.

    This began happening as soon as I updated to 5.6.1f1.
     
  3. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    253
    I'm in the same boat. Been happening since 5.6 and I'm all updated now.
     
  4. effx

    effx

    Joined:
    Aug 24, 2015
    Posts:
    6
    I'm having the same issue with 5.6.1p3. I can't figure out what's causing this issue. I can't close Unity as well and need to end task it. It's really intermittent but still happens consistently especially when I hit play and run the game a bit and then try to close Unity. This will often times make Unity unresponsive.

    About my setup:
    Windows 10 - 64bit
    Processor : i5 2500K
    Ram: 8Gb
    Graphic card: Nvidia geforce GTX980
    GFX Driver: 382.53
    Unity: 5.6.1p3

    I've tried to update everything - Unity, assets, GFX drivers. Not sure what else to do. Thanks.
     
  5. Lupinus

    Lupinus

    Joined:
    Feb 5, 2016
    Posts:
    16
    I've come across this issue a few times. I'm not sure if it'll help your situation or not but, keep an eye on the unity.exe memory usage. If I'm coding and testing repeatedly, it usually doesn't have an issue, but when the code doesn't exit cleanly (i.e. I'm debugging 3AM code) I've actually ran into issues with the memory filling up and Unity freezing.
     
  6. Tomza

    Tomza

    Joined:
    Aug 27, 2013
    Posts:
    591
    5.6.2 and the same problem - Unity freeze without any errors and CPU and RAM spike. Sometimes I am able to close the Editor with Ctrl + P, but if too much memory consumed, I need to kill the process to prevent it from blocking my computer up.

    It happens when I move mouse cursor in the game window.
     
  7. effx

    effx

    Joined:
    Aug 24, 2015
    Posts:
    6
    Yea I'm still dealing with this issue with 5.6.1p4. I checked my ram and Unity is using 400MB or so and I still have a few GB remaining free. It's really weird.

    Usually after I restart Unity, I can hit play once and then after stopping play it'll sometimes stop responding after a few minutes. More often than not it will stop responding for sure if I try to hit play again for the 2nd time. I need to then "end task" Unity and restart the program.

    CPU is stuck at 0% when Unity stops responding.

    This is really slowing down my development since pretty much every change I need to restart Unity and open my project again.

    Hopefully some one else has some more insight on what's going wrong?

    Thanks.
     
  8. ChromeCat

    ChromeCat

    Joined:
    Jan 27, 2016
    Posts:
    31
    Mine too with 5.6.1p1 and also 5.6.2p1.
    I've experienced that if unity freezes, all static members become null with no reason.
    So I attached a code somewhere.
    Code (CSharp):
    1. void Start(){
    2.   AppDomain.CurrentDomain.DomainUnload += (var, var2)=>{
    3.       Debug.LogError("AppDomain Unloaded!");
    4.   }
    5. }
    And this gets called when app gets freezed.
    It also happens on android also, except that appDomain doesn't gets unloaded, just freezes.

    So in UnityEditor, the internal error happens, and UnityEditor in order to restart assembly, it unloads current assembly, and load a new ones.

    Actually, my problem was related with AssetBundle.
    I made a new project and made a sample which causes the freeze problem.
    I've reported to Unity QA but they could not reproduce the problem.
    https://fogbugz.unity3d.com/default.asp?926516_6uerj5vpbu592740
     
  9. VrTechEx

    VrTechEx

    Joined:
    Aug 4, 2013
    Posts:
    36
    Got the same problem here!
    The process icon still cycling tho...
     
    JuratePasekaite likes this.
  10. Sanctus2099

    Sanctus2099

    Joined:
    Dec 11, 2013
    Posts:
    65
    Same problem on 5.6.2f1. From what I can see it has something to do with pressing play too soon after switching to unity from visual studio when it recompiles the code. Also happens if I stop the game and press play too fast.
     
  11. palodequeso

    palodequeso

    Joined:
    Mar 10, 2017
    Posts:
    6
    Did this go away in 2017? If so, I should update ASAP, this is a real bummer when you're hacking away at night.
     
  12. fandrfa

    fandrfa

    Joined:
    Sep 28, 2016
    Posts:
    2
    No, I use 2017.1 and Unity still freezes.
     
    strattoncrenshaw likes this.
  13. blogin

    blogin

    Joined:
    Feb 23, 2017
    Posts:
    1
    I had the same issue for the longest time 5.6.1/5.6.2. Very frustrating but eventually worked out the issue to some incompatibility with older add-ons. If you get the same result then maybe you have a similar problem.
    When Unity freezes with spinning processing icon (bottom right), go to Task Manager Processes and kill the mono.exe (sometimes there are more than 1).

    Unity should now come back and complain about fixing the compile errors.

    I made a copy of the project and worked on it to determine the issue. I looked up every downloaded asset add-on and checked the last time it was updated from oldest to newest. Starting from oldest, I deleted that entire add-on folder, commented out any compile errors and pressed play. If same freeze keeps happening, move to next add-on. I was lucky to find it on the second add-on "Easy Sound Manager" released 22 Sep 2016, Unity 5.4.1. Deleted it from my main project and have not seen the issue again. Good Luck :)
     
  14. devotionsolutions

    devotionsolutions

    Joined:
    Feb 9, 2013
    Posts:
    36
    Same happens to me on 2017.1.1p1. Didn't had a chance to go through all add-ons yet, but I'm not sure if this started to happen after we moved to 2017.1.1p1 or once we imported Facebook SDK.. (anyone else using this combination here?)
     
  15. Wesponki

    Wesponki

    Joined:
    Aug 22, 2017
    Posts:
    1
    This is happening to my right know (2017.1.1f1), at the moment I press "play" Unity freezes, with any project (even new ones)
     
  16. Peacewise

    Peacewise

    Joined:
    Feb 27, 2014
    Posts:
    49
    Also happening to me.
    Freezes maybe 20% of the time I hit play, must kill the process.
    There is no "spinning processing icon" in the bottom right when it happens to me. CPU is sometimes 0, sometimes 10-15%.

    Also, it seems that sometimes if I wait long enough, like 3-5 minutes or so while it is frozen, it will then suddenly proceed to start like nothing was wrong.
     
  17. ecquack

    ecquack

    Joined:
    Oct 17, 2017
    Posts:
    10
    This is happening to me now. I have no add-ons. I have Unity 2017.2.0f3
    I added some code to listen for UDP packets asynchronously. I can see this hanging or crashing the playback but it shouldn't freeze Unity itself. I have to use the task manager to kill Unity and restart it completely. I'd be happy to submit a code example if that would help.
     
  18. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    312
    Make sure you close all sockets and abort all your threads in OnApplicationQuit callback or Unity will freeze next time you hit play
     
    Last edited: Oct 28, 2017
    kevinatgame and cnewstead like this.
  19. Reticulatas

    Reticulatas

    Joined:
    Jul 31, 2012
    Posts:
    19
    I am still receiving this hang on 2017.1.b2. It appears to be totally random - 30% of the time or so. I have socket code, but I can reproduce this on scenes in which no networking is runnig,

    Log shows nothing of interest. I do not have any deprecated third party assets. I have had the hang happen on first play of the game after a restart, which suggests it is not un-cleaned up resources from a prior play. Waiting for script loads does not help (but avoids a similar hang in which script reloading occurs during transition into play, which may be related). Reloading scripts does not seem to help.

    This is really disruptive to my work,. how do we even file bugs for this?
     
  20. Reticulatas

    Reticulatas

    Joined:
    Jul 31, 2012
    Posts:
    19
    So I have a solution for my particular issue. Might work for other people

    In my setup, I have two scenes that start at play ("Global" and "Game"), one of which is composed of singletons some of which gets marked DontDestroyOnLoad on Awake() in their scripts. The other scene is my level, which takes awhile to initialize due to the size.
    I noticed that Unity does not handle mutli-level loading in standalone builds, so I had previously made a third level which merely loads the Global and Game levels and then destroys itself. This works great for Standalone builds and I moved on.

    Turns out, using this trick makes the freezing/hangs disappear. As long as the initial levels loaded is only this minimal scene with one script that loads the other two scenes, it never hangs.

    Maybe this will work for others?
     
    JuratePasekaite and esteban16108 like this.
  21. cnewstead

    cnewstead

    Joined:
    Sep 13, 2017
    Posts:
    1
    Thank you! This seems to have solved the problem for me.
     
    Xaratoga and kevinatgame like this.
  22. kevinatgame

    kevinatgame

    Joined:
    Aug 31, 2015
    Posts:
    6
    works for me!
    thank you drcrck!
    hope other people try this one
     
    Xaratoga likes this.
  23. spainchaud

    spainchaud

    Joined:
    Jan 12, 2018
    Posts:
    1
    I just downloaded Unity a few hours ago, and I am working my way through the Roll-a-Ball tutorial. Having the whole UI just freeze up is not very encouraging.

    Can someone explain how you "close all sockets and abort all your threads in OnApplicationQuit callback"?
     
  24. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    312
    I think closing sockets and threads is not your case
    May be you change source code while game is running in editor? It may cause freezes too.
     
  25. Deleted User

    Deleted User

    Guest

    In case you've attached debugger in mono/VS to Unity, you have to stop it before you can stop playing mode in Unity.
     
  26. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    123
    Still happening with Unity 2017.3.1 :(
     
  27. s4relok

    s4relok

    Joined:
    May 1, 2013
    Posts:
    2
    Still happening with Unity 2017.4.0f1 :(

    Turning off the internet helps in my case.
     
    Last edited: Apr 3, 2018
  28. Sarah0Salem

    Sarah0Salem

    Joined:
    Apr 19, 2018
    Posts:
    2
    Same here, but it was working before I added a random method perfectly!
     
  29. LutzJulius

    LutzJulius

    Joined:
    Jul 28, 2018
    Posts:
    1
    I've got the same problem, but try to disable some scripts, that's what had helped me but know I don't know why the script is wrong
     
  30. domdev

    domdev

    Joined:
    Feb 2, 2015
    Posts:
    350
    same here any fix?
     
  31. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    9,290
    Freezing on play is usually caused by an infinite loop in one of your scripts.
     
  32. TheChosen123

    TheChosen123

    Joined:
    Oct 15, 2017
    Posts:
    1
    my problem was i had typed
    Code (CSharp):
    1. for(int i = 360; i > 0; i++)
    instead of
    Code (CSharp):
    1. for(int i = 360; i > 0; i--)
    which is an infinite loop
     
  33. iamjowin

    iamjowin

    Joined:
    Oct 24, 2018
    Posts:
    3
    what if, we need an i++ instead of i--
     
  34. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    5,457
    Then you count upwards.
    Code (CSharp):
    1. for(int i = <something>; i < <bigger something>; i++)
     
  35. VortexInCortex

    VortexInCortex

    Joined:
    Apr 13, 2019
    Posts:
    2
    I think I found the stupidest way to fix this problem, idk but it worked for me in 2018.3.12f1 (Latest version so far).

    You open task manager and you delete "unity crash handler", that's how I fixed it...
     
  36. Alan-ea

    Alan-ea

    Joined:
    Jan 10, 2018
    Posts:
    3
    Ben kodlarımın içerisinde for döngüsü kullandım ve çalıştığında unity çalıştırınca dondu. Sürekli çalışıp unity kasmasına neden olan kod vardır diye düşünüyorum.
     
  37. fakeinc

    fakeinc

    Joined:
    Mar 31, 2019
    Posts:
    8
    Same here with 2019.1.7f1 and 2019.3.0a4. None of the above method works for me.
     
  38. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    170
    Make sure you didn't have any infinite loop, infinite loop could happen when using while loop, please check all the while loop carefully to see if there is an endless while loop.
     
  39. NewSystemGames

    NewSystemGames

    Joined:
    May 23, 2017
    Posts:
    299
    this just happened to me earlier, and it was freezing over all projects, even i tested blank new project and it froze, so can't be a while loop.

    What fixed it is by going to task manager and deleting all "Unity Hub" Tasks (I had several for some reason) and for now it's working...
     
  40. Lucas_Lundmark

    Lucas_Lundmark

    Joined:
    May 18, 2017
    Posts:
    2
    For me, it was the Time Scale. Some script set it to 0 and then never set it back, check this in Edit>Project settings>Time, normal is 1.
     
  41. wildmoos

    wildmoos

    Joined:
    Aug 15, 2013
    Posts:
    2
    Same thing here (Unity hanging when entering play mode)
    Killing all unity hub processes in task manager worked for me. (see NewSystemGames post above)
     
unityunity