I’m working on editor tool that is performing some heavy tasks in Edit Mode. The tool requires rendering and update loop to be executed.
The task executed by the tool consumes lots of time - so, after starting the task I usually want to switch to different app to do some other stuff - and there’s the problem: if Editor window loses focus, game loop no longer fires - so the task freezes.
Before Unity 2020 I was using this hacky way to solve that issue: when out of focus detected, I was calling SendMessage (pinvoke.net: SendMessage (user32)) to make Unity think it’s focused - even if it realy wasn’t.
Thing is this technique stopped working in Unity 2020 - I believe that’s because this fix: Unity Issue Tracker - [Windows Editor] InternalEditorUtility.isApplicationActive is inconsistent with the Editor's Windows focus state
So - is there any other way to keep updates in Edit Mode while editor not being focused?