Search Unity

Weird crash when unloading a scene, while loading a previous one. [UWP] [Xbox]

Discussion in 'Windows' started by StarGamingNetwork, Dec 31, 2020.

  1. StarGamingNetwork

    StarGamingNetwork

    Joined:
    Feb 2, 2015
    Posts:
    16
    The game is a UWP Game running on an Xbox ONE S using Unity 2020.1.13f and VS 2019. Each of my levels have their own scene. When they exit, they return to the main menu scene. I load main menu async. My loading screen shows it loaded 90% them boom. It does not crash in a Debug build however. Also no issues in the Editor. Every level scene does this both when loading Main Menu or if reloading itself.

    Everything I tried for a stack dump has failed. The call stack shows:

    UnityPlayer.dll!DebugStringToFilePostprocessedStacktrace(struct DebugStringToFileData const &) Unknown
    UnityPlayer.dll!DebugStringToFile(struct DebugStringToFileData const &) Unknown
    > UnityPlayer.dll!MemoryManager::WarnAdditionOverflow(enum AllocateOptions) Unknown
    UnityPlayer.dll!MemoryManager::Allocate(unsigned __int64,unsigned __int64,struct MemLabelId,enum AllocateOptions,char const *,int) Unknown
    UnityPlayer.dll!operator new[](unsigned __int64) Unknown
    UnityPlayer.dll!LightmapSettings::Rebuild(void) Unknown
    UnityPlayer.dll!LightmapSettings::RemoveLightmaps(int) Unknown
    UnityPlayer.dll!DidUnloadScene(int) Unknown
    UnityPlayer.dll!RuntimeSceneManager::UnloadAllScenesWithoutDestroyingGameObjects(void (*)(class UnityScene &)) Unknown
    UnityPlayer.dll!UnloadGameScene(void) Unknown
    UnityPlayer.dll!LoadSceneOperation: PlayerLoadSceneFromThread(void) Unknown
    UnityPlayer.dll!LoadSceneOperation::IntegrateMainThread(void) Unknown
    UnityPlayer.dll!PreloadManager::UpdatePreloadingSingleStep(enum PreloadManager::UpdatePreloadingFlags,int) Unknown
    UnityPlayer.dll!PreloadManager::UpdatePreloading(void) Unknown
    UnityPlayer.dll!ExecutePlayerLoop(struct NativePlayerLoopSystem *) Unknown
    UnityPlayer.dll!ExecutePlayerLoop(struct NativePlayerLoopSystem *) Unknown
    UnityPlayer.dll!PlayerLoop(void) Unknown
    UnityPlayer.dll!UnityPlayer::AppCallbacks: DoPerformUpdateAndRender(void) Unknown
    UnityPlayer.dll!UnityPlayer::AppCallbacks::_AppThreadImplementation(void *) Unknown
    ntdll.dll!00007ffd914415ef() Unknown

    Looks like it is related to lighting but I have no idea what to do about it.
     
  2. StarGamingNetwork

    StarGamingNetwork

    Joined:
    Feb 2, 2015
    Posts:
    16
    Update:

    Disabling baked lighting causes it not to happen. Both Progressive and Enlighten do it, though the call stack is slightly different with enlighten. So it is definitely related to lighting.

    It also only occurs on the Xbox One. If I run the UWP on a Windows 10 PC it does not happen.
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you report a bug on this?
     
  4. StarGamingNetwork

    StarGamingNetwork

    Joined:
    Feb 2, 2015
    Posts:
    16
    Yes, I will
     
  5. StarGamingNetwork

    StarGamingNetwork

    Joined:
    Feb 2, 2015
    Posts:
    16
    Bug # 1318134
    Sorry it took so long but I had to wait until I had time to make a small example which turned out to be easier than I thought since it happens 100% of the time if light mapping is used. It is currently impossible to make a UWP for the Xbox if lightmapping is used.
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Thanks, we'll take a look.
     
  7. perchangpete

    perchangpete

    Joined:
    Oct 14, 2016
    Posts:
    13
    I ran into this problem on a UWP master build. Using this code before a scene load seemed to get around the problem:

    LightmapSettings.lightmaps = new LightmapData[0];
    Resources.UnloadUnusedAssets();
     
    Last edited: May 13, 2021
  8. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
    I also have this bug in Unity 2020.3.12f1! For Windows.

    Was it fixed in Unity 2021?
     
  9. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
  10. StarGamingNetwork

    StarGamingNetwork

    Joined:
    Feb 2, 2015
    Posts:
    16
    Perfect. Unity was not helpful. They could not reproduce this. I sent them a simple project that does it and their only suggestion was thinking I had changed the sample after sending it to them to cause this. Your solution fixed it so I can now use the 2020 editor on UWP.
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Hey, we just fixed this. The fix will be in 2020.3.17f1 and 2021.1.18f1. It turned out to be more gnarly than expected as it was caused by a bug in the C++ compiler.
     
  12. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    Thank you @perchangpete

    That worked for me as a temporary fix.
     
  13. Behappy859

    Behappy859

    Joined:
    Jul 25, 2019
    Posts:
    15
    Does this you put the code in Awake method? I think I might be having the same issue.
     
  14. StarGamingNetwork

    StarGamingNetwork

    Joined:
    Feb 2, 2015
    Posts:
    16
    You put that right before you call loadscene.
     
  15. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    FWIW - Unity fixed this a month or so back and the fix certainly worked for me (using the 2020.3 LTS builds)
     
    Salvador-Romero likes this.
  16. Behappy859

    Behappy859

    Joined:
    Jul 25, 2019
    Posts:
    15
    thank you. Sadly im using unity 2019.28.f1. Also everything works fine on my Xbox1 Slim. However the new xbox X, like PS5. Always crashes when it comes to entering my name in the main menu.
     
  17. MMHouston

    MMHouston

    Joined:
    Jun 3, 2021
    Posts:
    1
    I am testing out on 2020.3.29f1 and the issue still persists! Game is still crashing on scene load.
     
  18. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Must be a different issue then. Can you report a bug?