Hi,
I have a script that creates threads, open .Net sockets, and runs in the Editor. The issue I have is that if any sockets are open, Unity hangs if I go and edit my code, at the point it compiles the code again it does not kill my threads and close my sockets (at least properly). In order to avoid Unity to hang I need to close any connection/thread before the code is recompiled.
So far the way I found to handle this is to close my sockets/threads in the OnDisable method of an EditorWindow, because it is called just before the code gets recompiled. I don’t want to depend on having this EditorWindow opened in order to handle this.
Is there an alternative method that gets called just before the code gets recompiled? For example some static method, or anything in a MonoBehavior, or some delegate I could use in the EditorApplication class, etc.