Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Keep updates in Edit Mode when not focused

Discussion in 'Editor & General Support' started by mruce, Aug 12, 2020.

  1. mruce

    mruce

    Joined:
    Jul 23, 2012
    Posts:
    28
    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 (https://www.pinvoke.net/default.aspx/user32.SendMessage) 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: https://issuetracker.unity3d.com/is...nsistent-with-the-editors-windows-focus-state

    So - is there any other way to keep updates in Edit Mode while editor not being focused?
     
  2. mruce

    mruce

    Joined:
    Jul 23, 2012
    Posts:
    28
    A little BUMP!

    How can I force Unity to perform full update loop while not in Play Mode AND Editor is not focused?