0

I have a unity project that freezes I think randlomly on play and on compilation events. As far as I checked, could be for something related to this. Seems that a blocked network thread persisting between playmode stop/starts could be causing the issue. I have researched about how to track and stop threads so that I can handle that when I stop playmode in editor, but as far as I checked here you can handle your own thread created.

As the project freezes and there is no chance to debug, so no chance to check which thread is cousing the problem if any, as my project is big, my question then is if there is a clean way to stop/terminate cleanly all the active threads on the editor when you stop.

Thanks in advance for any help.

This is the unity task manager when the freeze takes place. Note the CPU 0%.

enter image description here

rustyBucketBay
  • 4,320
  • 3
  • 17
  • 47

1 Answers1

1

Hi this is not a solution but maybe can help you. If you are using some TCPclient or UPDclient remember that you need to close the client when stop the editor

using UnityEngine;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class DetectStopEditor : MonoBehaviour
{


// Start is called before the first frame update
void Start()
{
#if UNITY_EDITOR
    EditorApplication.playModeStateChanged += Algo;
#endif
}
#if UNITY_EDITOR
public void Algo(PlayModeStateChange state)
{
   
    if (state == PlayModeStateChange.ExitingPlayMode)
    {
        //DO SOMETHING
        Debug.Log(string.Format("[{0}] Exiting playmode.",state.ToString()));
    }
}
#endif
}
Mario
  • 601
  • 3
  • 7
  • Thanks a lot for your answer. In may case when I removed "Temp" and "Library" folders and reimported the project, the problem did not occur anymore. If I can reproduce the issue I will check your suggestion out – rustyBucketBay Sep 11 '20 at 09:44