Search Unity

[RESOLVED] Long scene load times in Release builds (Windows 2019.3.1)

Discussion in 'Editor & General Support' started by YD_JMysior, Feb 25, 2020.

  1. YD_JMysior

    YD_JMysior

    Joined:
    Aug 4, 2016
    Posts:
    60
    Hello everyone,
    after updating my current game to 2019.3.1 I've noticed a great increase in scene loading times in the Player in Release builds ("Development build" option unchecked in the build settings). A scene that takes around 200 ms to load in the editor or in the Development Player takes 2000 ms (two seconds!) to load in the release build.

    I've tried creating a clean repro project, but load times were normal, so it's not exactly Unity related issue. I've copied all the project settings from my game to the repro project - still, the repro project works normally. I've put a StopWatch diagnostics only around the `SceneManager.LoadScene()` call to make sure it's not something weird I've done in my script. Just this call hangs everything for 2 seconds...
    Since this problem is "only" in the Release Player I cannot check the cause of it in the Profiler.

    Could anyone point me in the direction of where to look and how to diagnose the problem? I'm out of idea at this time...
     
  2. YD_JMysior

    YD_JMysior

    Joined:
    Aug 4, 2016
    Posts:
    60
    Nevermind. Turned out one of my scripts was subscribed to the SceneManager.sceneUnloaded event. The script saves data on every scene load and data scrambling was set to true via Debug.isDebugBuild querry.

    For anyone with the same problem - search your codebase for Debug.isDebugBuild calls and see if something heavy is not going on there.