Search Unity

Editor doesn't finish load scene if losing focus right after pressing play

Discussion in 'Editor & General Support' started by alexnicola07, Jul 9, 2021.

  1. alexnicola07

    alexnicola07

    Joined:
    Jun 18, 2015
    Posts:
    2
    Hello!
    For years I am facing this problem.
    My scene is quite heavy and takes 20-30 seconds to load when pressing the Play button in the editor.
    The problem is - If right after pressing play I immediately switch focus to a different window (such as chrome browsing or looking into other folders) the scene will never finish loading. It seems like the editor is not running in the background if losing focus right after pressing play.

    If then I give back the focus to the editor, wait a few seconds and then go back to browsing, Then the scene finish loading in the background.

    Does anybody faces a similar issue and know what can be done?
     
  2. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,118
    I've noticed this on many games even those not made with unity. I assume the operating system is pausing the game execution to allow the user to use the resources properly.

    One thing you can try is to see if you can make your game run in borderless fullscreen window mode instead or regular fullscreen mode.

    All games that have this are not paused when switching to another window.

    Also if your scene is heavy on the loading, invest some time to learn about addressable and maybe you can implement those in your game to streamline the loading time.
     
  3. alexnicola07

    alexnicola07

    Joined:
    Jun 18, 2015
    Posts:
    2
    I am talking about running it on the editor itself.
     
  4. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,118