Search Unity

Windows Build crashing silently during scene switching

Discussion in 'Windows' started by DeeCeptor, Apr 20, 2022.

  1. DeeCeptor

    DeeCeptor

    Joined:
    Aug 4, 2013
    Posts:
    33
    EDIT: Solution has been found. After much trial and error, the game no longer crashes during our loading screen, even with steam running. The issue with the graphics driver DOES NOT OCCUR if the graphics API being used is OpenGL. Adding that as an graphics API option to the build, and adding this launch parameter:
    -force-glcore32
    fixed the issue (though for this player's driver, it still didn't like some of the Standard Assets shaders for post-processing).



    Hi. I've made a StandaloneWindows64 build of the game. It works completely fine in the editor, and the windows build works with 99% of players, however a few are reporting it crashes when switching scenes.

    Attached is the Player.log and a crash dump. Windows 10 Pro 64-bit
    The application just silently crashes/quits when going from my Splashscreen scene (which is a loading screen) to my main menu scene. It may happen during of an LoadSceneAsync operation or during an UnloadSceneAsync, but I'm not completely sure. I've added some more Debug statements in a newer build to find out. Scene switching code below:
    Code (CSharp):
    1.  
    2.     IEnumerator Async_Load_Level()
    3.     {
    4.         UIManager.ui_manager.loading_icon.SetActive(true);
    5.         UIManager.ui_manager.loading_text.gameObject.SetActive(true);
    6.         string active_scene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
    7.         DestroyImmediate(UnityEngine.EventSystems.EventSystem.current.gameObject);
    8.  
    9.         AsyncOperation AO = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(level_to_load);
    10.         AO.allowSceneActivation = false;
    11.         int progress = (int)(AO.progress * 100f);
    12.         while (AO.progress < 0.9f)
    13.         {
    14.             progress = Mathf.Max(progress, (int)(AO.progress * 100f));
    15.             UIManager.ui_manager.loading_text.text = progress + "%";
    16.             yield return null;
    17.         }
    18.         AO.allowSceneActivation = true;
    19.         while (AO.progress < 1f)
    20.         {
    21.             progress = Mathf.Max(progress, (int)(AO.progress * 100f));
    22.             UIManager.ui_manager.loading_text.text = progress + "%";
    23.             yield return null;
    24.         }
    25.         UIManager.ui_manager.loading_text.text = "100%";
    26.         yield return 0;
    27.         UIManager.ui_manager.loading_icon.SetActive(false);
    28.         UIManager.ui_manager.loading_text.gameObject.SetActive(false);
    29.  
    30.         UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync(active_scene);
    31.     }
    32.  

    I noticed the VRAM for this player is very low - 480mb. Could it be unable to allocate enough memory? This could explain why for most players it works, but for a few it doesn't.
     

    Attached Files:

    Last edited: Apr 23, 2022
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Do you have a crash dump from the crash?

    GPU running out of memory shouldn't be an issue, Windows will use system RAM to page VRAM contents on demand. However, if the person playing your game has a 14 year old GPU, it's likely they don't have a lot of RAM too which makes it plausible that they run out of memory.

    Another possibility is the fact that the GPU only supports D3D11 feature level 10.0. Does your game work on your machine if you run it with "-force-feature-level-10-0" command line argument?
     
  3. DeeCeptor

    DeeCeptor

    Joined:
    Aug 4, 2013
    Posts:
    33
    Thanks for the suggestions. For crash dump, do you mean stuff located at: %TMP%\CompanyName\ProductName\Crashes ? I'll try to get that from the player.

    I tried adding the "-force-feature-level-10-0" command line argument, and it still worked for me. Player.log file confirming forcing of D3D11 to 10.0 below:

    Code (CSharp):
    1. Mono path[0] = 'C:/Builds/steamworks_sdk/tools/ContentBuilder/content/KaijuWars_Windows/KaijuWars_Data/Managed'
    2. Mono config path = 'C:/Builds/steamworks_sdk/tools/ContentBuilder/content/KaijuWars_Windows/MonoBleedingEdge/etc'
    3. Initialize engine version: 2020.1.0b7 (6cfebb967dcd)
    4. [Subsystems] Discovering subsystems at path C:/Builds/steamworks_sdk/tools/ContentBuilder/content/KaijuWars_Windows/KaijuWars_Data/UnitySubsystems
    5. GfxDevice: creating device client; threaded=1
    6. d3d11: QueryInterface(IDXGIFactory5) failed (80004002).
    7. Direct3D:
    8.     Version:  Direct3D 11.0 [level 10.0]
    9.     Renderer: NVIDIA GeForce GTX 1070 (ID=0x1b81)
    10.     Vendor:  
    11.     VRAM:     8046 MB
    12.     Driver:   27.21.14.6109
    13. VirtualTexturing requires compute shaders
    14. Begin MonoManager ReloadAssembly
    15. - Completed reload, in  0.186 seconds
    16. D3D11 device created for Microsoft Media Foundation video decoding.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Yes.
     
  5. DeeCeptor

    DeeCeptor

    Joined:
    Aug 4, 2013
    Posts:
    33
    Attached is a crash dump.
     

    Attached Files:

  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Well, I've got either good or bad news, depending on how you look at it.

    It seems the crash is happening inside the Nvidia graphics driver. The graphics driver in use is 6 years old and unfortunately it's the latest driver available for that 14 year old GPU. Furthermore, the crash is happening during steam overlay rendering so it's not even the game that is triggering it (at least that's what it looks like to me).

    I would advice the player to try disabling steam overlay for your game and see if it makes the crash go away.

    It's also possible that the driver has issues with DXGI flip model swapchain (which was introduced in Windows 8) as games didn't really start using it until 2017 (which was after this driver shipped). They can force Unity to fall back to Windows 7 style swapchain using the "-force-d3d11-bltblt-mode" command line argument, but it should only be done as the last resort as it has severe performance and input latency penalties. I've seen really old drivers not liking flip model swapchains in the past, but it's still a very rare issue.
     
  7. DeeCeptor

    DeeCeptor

    Joined:
    Aug 4, 2013
    Posts:
    33
    Thanks for the excellent suggestions. We tried having the player run the game without steam running at all (running the .exe. directly). Attached is the crash dump without steam. Strangely, the game gets past the loading screen about HALF the time.

    We also tried running it separately with and without the following launch options:
    -force-d3d11-bltblt-mode
    -force-feature-level-10-0
    But the game still crashed.

    We agree this seems to have something to do with the graphics driver, but it's strange it only happens SOMETIMES and not EVERY TIME.
     

    Attached Files:

  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Steam overlay is still present in your latest dump: upload_2022-4-20_20-35-42.png

    And it's definitely doing its drawing at the time of the crash:

    upload_2022-4-20_20-37-50.png

    I'd try disabling it in the steam settings instead of running the game directly.
     
  9. DeeCeptor

    DeeCeptor

    Joined:
    Aug 4, 2013
    Posts:
    33
    Thanks for the suggestions - looks like I submitted the wrong crash dump where steam was running.

    However after much trial and error, we did find a solution - even WITH steam running. The issue with the graphics driver DOES NOT OCCUR if the graphics API being used is OpenGL. Adding that as an graphics API option to the build, and adding this launch parameter:
    -force-glcore32
    fixed the issue (though for this player's driver, it still didn't like some of the Standard Assets shaders for post-processing).