Search Unity

[Suggestion] Don't steal window focus after play stop

Discussion in 'Editor & General Support' started by sand_lantern, Aug 28, 2019.

  1. sand_lantern

    sand_lantern

    Joined:
    Sep 15, 2017
    Posts:
    210
    As my project has grown, it takes longer and longer to start and stop from play mode. This is pretty much expected, though kinda a nuisance. More of a nuisance, however is whenever I stop from playing, unity lags for 10-20 seconds freezing the editor. Then, the moment it finishes, it recaptures focus of the editor.

    Thus, my workflow is something like:
    Test some stuff in play mode
    Find things I want to change and stop the editor
    Go to Visual Studio to make appropriate code changes
    As soon as I start typing Unity steals focus and interrupts what I was trying to do.
    Also, due to how much space my workflow uses, it also covers all of the screen with Unity.
    upload_2019-8-28_11-5-40.png

    Note how unity also covers over visual studio when this happens.
    It would be really nice if Unity wouldn't do this. It's very disruptive to my workflow.
     
    Joe-Censored likes this.
  2. sand_lantern

    sand_lantern

    Joined:
    Sep 15, 2017
    Posts:
    210
  3. Soundwolf776

    Soundwolf776

    Joined:
    Mar 21, 2015
    Posts:
    17
    Yes. It's the most annoying Unity 'feature', making it a physical pain to work on a more or less significant project that takes a few dozens of seconds to load.

    User is essentially locked into staring for at the loading bars for half a minute, because it's impossible to switch to anything else - editor will continually keep stealing focus, not only on play transition, but also during scene loads and certain operations. 30 seconds may sound like not much, but when you're actively testing/debugging stuff, it can add to an hour per day spent looking at the loading bar.
     
  4. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    Not counting the problem when you press start, then work on another thing, and close the other window exactly at the time when Unity takes back the focus...
    Now you have to wait for it to finish starting up, and then you have to wait for it to close, and then you have to wait for it to relaunch, and then you have to wait for it to restart...

    I have finished writing this message, and Unity still haven't started the game yet.....
     
    sand_lantern likes this.
  5. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    I've been using StayFocused to get around this problem, which blocks all Windows focus stealing. It works well, although the beta sometimes disappears from the taskbar. I just relaunch when that happens. It's a simple exe that runs at startup.

    https://github.com/bladeSk/StayFocused