Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

level0 is corrupted, only for Steam builds

Discussion in 'Windows' started by vladimir-fs, Apr 16, 2021.

  1. vladimir-fs

    vladimir-fs

    Joined:
    Nov 28, 2019
    Posts:
    22
    Hi all,

    we recently started getting this crash on the Steam version of our game (when run from Steam):

    Code (CSharp):
    1. The file 'I:/path/to/game/game_Data/level0' is corrupted! Remove it and launch unity again!
    2. [Position out of bounds!]
    3. (Filename:  Line: 220)
    4.  
    5. Crash!!!
    6. SymInit: Symbol-SearchPath: '.;I:\path\to\game;I:\path\to\game;C:\WINDOWS;C:\WINDOWS\system32;SRV*C:\websymbols*http://msdl.microsoft.com/download/symbols;', symOptions: 534, UserName: 'myusername'
    7. OS-Version: 10.0.0
    8. I:\path\to\game\game.exe:game.exe (00840000), size: 655360 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2019.4.13.34615
    9. C:\WINDOWS\SYSTEM32\ntdll.dll:ntdll.dll (77D10000), size: 1716224 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    10. C:\WINDOWS\System32\KERNEL32.DLL:KERNEL32.DLL (76DE0000), size: 983040 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.804
    11. C:\WINDOWS\System32\KERNELBASE.dll:KERNELBASE.dll (76BC0000), size: 2179072 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.804
    12. I:\path\to\game\UnityPlayer.dll:UnityPlayer.dll (781D0000), size: 20750336 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2019.4.13.34615
    13. C:\WINDOWS\System32\USER32.dll:USER32.dll (76930000), size: 1662976 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    14. C:\WINDOWS\System32\win32u.dll:win32u.dll (77060000), size: 98304 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.867
    15. C:\WINDOWS\System32\GDI32.dll:GDI32.dll (764A0000), size: 143360 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    16. C:\WINDOWS\System32\gdi32full.dll:gdi32full.dll (76F80000), size: 901120 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    17. C:\WINDOWS\System32\msvcp_win.dll:msvcp_win.dll (763B0000), size: 503808 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.789
    18. C:\WINDOWS\System32\ucrtbase.dll:ucrtbase.dll (75CD0000), size: 1179648 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.789
    19. C:\WINDOWS\System32\ole32.dll:ole32.dll (76AD0000), size: 929792 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    20. C:\WINDOWS\System32\RPCRT4.dll:RPCRT4.dll (77B40000), size: 786432 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    21. C:\WINDOWS\System32\combase.dll:combase.dll (76570000), size: 2625536 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    22. C:\WINDOWS\SYSTEM32\VERSION.dll:VERSION.dll (741A0000), size: 32768 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    23. C:\WINDOWS\System32\msvcrt.dll:msvcrt.dll (76800000), size: 782336 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 7.0.19041.546
    24. C:\WINDOWS\System32\SHLWAPI.dll:SHLWAPI.dll (76F30000), size: 282624 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    25. C:\WINDOWS\System32\SETUPAPI.dll:SETUPAPI.dll (773F0000), size: 4411392 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    26. C:\WINDOWS\System32\cfgmgr32.dll:cfgmgr32.dll (76EF0000), size: 241664 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    27. C:\WINDOWS\System32\bcrypt.dll:bcrypt.dll (764D0000), size: 102400 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    28. C:\WINDOWS\System32\ADVAPI32.dll:ADVAPI32.dll (764F0000), size: 499712 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.610
    29. C:\WINDOWS\System32\sechost.dll:sechost.dll (75C50000), size: 483328 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.789
    30. C:\WINDOWS\System32\SHELL32.dll:SHELL32.dll (75DF0000), size: 5980160 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    31. C:\WINDOWS\System32\OLEAUT32.dll:OLEAUT32.dll (77C00000), size: 614400 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.804
    32. C:\WINDOWS\System32\IMM32.dll:IMM32.dll (75C20000), size: 151552 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    33. C:\WINDOWS\System32\CRYPT32.dll:CRYPT32.dll (772E0000), size: 1052672 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    34. C:\WINDOWS\SYSTEM32\WINMM.dll:WINMM.dll (74760000), size: 163840 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    35. C:\WINDOWS\System32\WS2_32.dll:WS2_32.dll (76430000), size: 405504 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    36. C:\WINDOWS\SYSTEM32\WINHTTP.dll:WINHTTP.dll (70D00000), size: 827392 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    37. C:\WINDOWS\SYSTEM32\HID.DLL:HID.DLL (63F90000), size: 40960 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    38. C:\WINDOWS\SYSTEM32\OPENGL32.dll:OPENGL32.dll (00DC0000), size: 1064960 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    39. C:\WINDOWS\SYSTEM32\GLU32.dll:GLU32.dll (50030000), size: 258048 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    40. C:\Program Files (x86)\Steam\gameoverlayrenderer.dll:gameoverlayrenderer.dll (7A9D0000), size: 1650688 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.48.43.99
    41. C:\WINDOWS\System32\PSAPI.DLL:PSAPI.DLL (76EE0000), size: 24576 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    42. C:\WINDOWS\SYSTEM32\kernel.appcore.dll:kernel.appcore.dll (74130000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    43. C:\WINDOWS\System32\bcryptPrimitives.dll:bcryptPrimitives.dll (75BC0000), size: 380928 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.662
    44. C:\WINDOWS\system32\uxtheme.dll:uxtheme.dll (746E0000), size: 475136 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    45. C:\WINDOWS\System32\shcore.dll:shcore.dll (77850000), size: 552960 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    46. C:\WINDOWS\SYSTEM32\windows.storage.dll:windows.storage.dll (71D20000), size: 6324224 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    47. C:\WINDOWS\SYSTEM32\Wldp.dll:Wldp.dll (71CA0000), size: 147456 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.662
    48. C:\WINDOWS\SYSTEM32\profapi.dll:profapi.dll (71BF0000), size: 98304 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    49. I:\path\to\game\MonoBleedingEdge\EmbedRuntime\mono-2.0-bdwgc.dll:mono-2.0-bdwgc.dll (7AB70000), size: 4448256 (result: 0), SymType: '-deferred-', PDB: ''
    50. C:\WINDOWS\system32\mswsock.dll:mswsock.dll (710E0000), size: 335872 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    51. C:\WINDOWS\System32\MSCTF.dll:MSCTF.dll (779B0000), size: 868352 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    52. C:\WINDOWS\SYSTEM32\d3d11.dll:d3d11.dll (6CE10000), size: 1966080 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    53. C:\WINDOWS\SYSTEM32\dxgi.dll:dxgi.dll (6CD40000), size: 794624 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    54. C:\WINDOWS\System32\DriverStore\FileRepository\nvgbdi.inf_amd64_bbb376926fd0f7ba\nvldumd.dll:nvldumd.dll (61890000), size: 872448 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 27.21.14.5709
    55. C:\WINDOWS\SYSTEM32\msasn1.dll:msasn1.dll (72350000), size: 57344 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    56. C:\WINDOWS\SYSTEM32\cryptnet.dll:cryptnet.dll (6C220000), size: 155648 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    57. C:\WINDOWS\SYSTEM32\cryptbase.dll:cryptbase.dll (72330000), size: 40960 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    58. C:\WINDOWS\System32\WINTRUST.DLL:WINTRUST.DLL (778E0000), size: 290816 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.804
    59. C:\WINDOWS\System32\imagehlp.dll:imagehlp.dll (77830000), size: 102400 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    60. C:\WINDOWS\SYSTEM32\CRYPTSP.dll:CRYPTSP.dll (71D00000), size: 77824 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    61. C:\WINDOWS\system32\rsaenh.dll:rsaenh.dll (71CD0000), size: 192512 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    62. C:\WINDOWS\System32\DriverStore\FileRepository\nvgbdi.inf_amd64_bbb376926fd0f7ba\nvwgf2um.dll:nvwgf2um.dll (5F2B0000), size: 39686144 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 27.21.14.5709
    63. C:\WINDOWS\SYSTEM32\dxcore.dll:dxcore.dll (5F280000), size: 180224 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    64. C:\WINDOWS\System32\clbcatq.dll:clbcatq.dll (77930000), size: 516096 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2001.12.10941.16384
    65. C:\WINDOWS\system32\wbem\wbemprox.dll:wbemprox.dll (54B00000), size: 53248 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    66. C:\WINDOWS\SYSTEM32\wbemcomn.dll:wbemcomn.dll (54A80000), size: 475136 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    67. C:\WINDOWS\system32\wbem\wbemsvc.dll:wbemsvc.dll (54A70000), size: 65536 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    68. C:\WINDOWS\system32\wbem\fastprox.dll:fastprox.dll (549A0000), size: 823296 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    69. C:\WINDOWS\SYSTEM32\amsi.dll:amsi.dll (54780000), size: 73728 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    70. C:\WINDOWS\SYSTEM32\USERENV.dll:USERENV.dll (741B0000), size: 151552 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.572
    71. C:\ProgramData\Microsoft\Windows Defender\Platform\4.18.2103.7-0\X86\MpOav.dll:MpOav.dll (546A0000), size: 438272 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 4.18.2103.7
    72. C:\WINDOWS\SYSTEM32\mscms.dll:mscms.dll (63500000), size: 602112 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    73. C:\WINDOWS\SYSTEM32\ColorAdapterClient.dll:ColorAdapterClient.dll (634F0000), size: 49152 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    74. C:\WINDOWS\SYSTEM32\icm32.dll:icm32.dll (51F20000), size: 253952 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    75. C:\WINDOWS\System32\MMDevApi.dll:MMDevApi.dll (635A0000), size: 438272 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.789
    76. C:\WINDOWS\System32\DEVOBJ.dll:DEVOBJ.dll (71030000), size: 147456 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    77. C:\WINDOWS\SYSTEM32\AUDIOSES.DLL:AUDIOSES.DLL (53EA0000), size: 1277952 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.789
    78. C:\WINDOWS\SYSTEM32\powrprof.dll:powrprof.dll (74150000), size: 278528 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    79. C:\WINDOWS\SYSTEM32\UMPDC.dll:UMPDC.dll (72340000), size: 53248 (result: 0), SymType: '-deferred-', PDB: ''
    80. C:\WINDOWS\SYSTEM32\resourcepolicyclient.dll:resourcepolicyclient.dll (6B940000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    81. C:\WINDOWS\SYSTEM32\xinput1_3.dll:xinput1_3.dll (146C0000), size: 90112 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 9.18.944.0
    82. C:\WINDOWS\SYSTEM32\dcomp.dll:dcomp.dll (62C60000), size: 1462272 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    83. C:\WINDOWS\SYSTEM32\dwmapi.dll:dwmapi.dll (746B0000), size: 155648 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
    84. C:\WINDOWS\SYSTEM32\textinputframework.dll:textinputframework.dll (63330000), size: 757760 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    85. C:\WINDOWS\SYSTEM32\CoreUIComponents.dll:CoreUIComponents.dll (62EA0000), size: 2613248 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    86. C:\WINDOWS\SYSTEM32\CoreMessaging.dll:CoreMessaging.dll (63120000), size: 634880 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.867
    87. C:\WINDOWS\SYSTEM32\ntmarta.dll:ntmarta.dll (70490000), size: 167936 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
    88. C:\WINDOWS\SYSTEM32\wintypes.dll:wintypes.dll (6C590000), size: 897024 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
    89. C:\WINDOWS\SYSTEM32\dbghelp.dll:dbghelp.dll (6A3B0000), size: 1605632 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.867
    90. C:\WINDOWS\SYSTEM32\SspiCli.dll:SspiCli.dll (704D0000), size: 163840 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.488
    After analyzing the dmp file in windbg I got the following stack trace:

    Code (CSharp):
    1. STACK_TEXT:
    2. 1544f4a8 7b28521d 01c39e80 1544f8e0 1bc39e80 UnityPlayer!DebugStringToFilePostprocessedStacktrace+0x414
    3. 1544f558 7ad8dec0 1544f618 00086e64 00000001 UnityPlayer!DebugStringToFile+0x1fd
    4. 1544f664 7ad8e472 00086e64 00086e65 1be06e74 UnityPlayer!CachedReader::OutOfBoundsError+0x300
    5. 1544f684 7ae83fcf 1b9eee5b 00000001 1bc3984c UnityPlayer!CachedReader::UpdateReadCache+0x22
    6. 1544f69c 7ae7e026 1544f8cc 1544f6c8 1bc39858 UnityPlayer!Transfer_Blittable_SingleValueField<StreamedBinaryRead,unsigned char>+0x4f
    7. 1544f6b0 7a886306 1bc39854 1544f6c8 1544f8cc UnityPlayer!Transfer_Blittable<StreamedBinaryRead,0,unsigned char>+0x16
    8. 1544f6e4 7ae7becf 1544f770 1544f8cc 1544f75c UnityPlayer!ExecuteSerializationCommands<JSONWrite>+0x86
    9. 1544f788 7ae7bf9e 1544f8cc 1b9eee00 12894020 UnityPlayer!TransferScriptingObject<StreamedBinaryRead,0>+0x15f
    10. 1544f7a4 7ae8a943 1544f8cc 1b9eee00 12894020 UnityPlayer!TransferScriptingObject<StreamedBinaryRead>+0x1e
    11. 1544f7d8 7ae8bb28 1ab3be10 1ab3be8c 1544f8cc UnityPlayer!SerializableManagedRefTransfer::TransferEngineAndMonoInstance<StreamedBinaryRead>+0x123
    12. 1544f7f8 7ae5b950 1ab3be10 1ab3be8c 1544f8cc UnityPlayer!SerializableManagedRefTransfer::Transfer+0x18
    13. 1544f81c 7ae97c7d 1544f8cc 056ebea0 1544f9d8 UnityPlayer!MonoBehaviour::VirtualRedirectTransfer+0x40
    14. 1544f950 7ae912b2 000012e1 00000000 00086e40 UnityPlayer!SerializedFile::ReadObject+0x39d
    15. 1544f990 7ae8feb2 0002070e 1ac95b70 154d3ec0 UnityPlayer!PersistentManager::ReadAndActivateObjectThreaded+0x122
    16. 1544fa68 7ad87745 1548e110 0001e14c 154727b0 UnityPlayer!PersistentManager::LoadFileCompletelyThreaded+0x4b2
    17. 1544fb54 7ad87eb3 7ba33570 059b5590 059b5590 UnityPlayer!LoadSceneOperation::Perform+0x365
    18. 1544fb74 7ad8815f 7adf77f0 059b5590 059b5590 UnityPlayer!PreloadManager::ProcessSingleOperation+0x123
    19. 1544fbbc 7ad881bb 1544fbe0 7adf7836 059b5590 UnityPlayer!PreloadManager::Run+0x13f
    20. 1544fbc4 7adf7836 059b5590 059b5590 04ca7370 UnityPlayer!PreloadManager::Run+0xb
    21. 1544fbe0 76b4fa29 059b5590 76b4fa10 1544fc4c UnityPlayer!Thread::RunThreadWrapper+0x46
    22. 1544fbf0 771f7c7e 059b5590 f8cce5c1 00000000 kernel32!BaseThreadInitThunk+0x19
    23. 1544fc4c 771f7c4e ffffffff 772188d0 00000000 ntdll!__RtlUserThreadStart+0x2f
    24. 1544fc5c 00000000 7adf77f0 059b5590 00000000 ntdll!_RtlUserThreadStart+0x1b
    Reproducing this has been difficult. Builds made from the Editor work fine. Builds made through CLI calls with -batchmode crash then start working after a couple of builds. (Maybe I manually opened the editor between builds?). Jenkins builds calling the same CLI command but also doing a
    git clean -ffdx
    and
    git reset --hard
    before checkout fail every time. I've tried manually calling git clean and then the same batchmode command and the issue doesn't show up.

    Other platforms (Windows Standalone, MacOS Standalone, PS4, XBO, Switch, mobile) use the same build process and work without issue.

    I've tried looking through our codebase for compiler flag checks (STEAM and UNITY_EDITOR, specifically) to try and find if we have any weird code commented out for these specific targets but everything seems in order.
    I've tried loading all assets, marking them as dirty and saving them to try and eliminate serialization errors. There were no errors.
    I've tried going back 100 commits but the problem persists. The game was stable at that point in time, I just can't make a working build from that point in history right now.

    We're using Unity 2019.4.13.

    Could this be an issue with Jenkins? Batchmode? Cleaning the repo? Did anyone encounter anything similar? What else could I check?

    Any help would be greatly appreciated.
     
    Last edited: Apr 16, 2021
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,505
  3. vladimir-fs

    vladimir-fs

    Joined:
    Nov 28, 2019
    Posts:
    22
    Hey, thanks for responding. I've sent the dump file via PM.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,505
    It looks like the crash happens when deserializing the class named "SteamPlatformManager". It seems to have two bool fields, named "lobbyProcessing" and "LobbyProcessing". It successfully reads the first one, and fails reading the second one.

    Is there anything special about that class? Do you have any idea why it has two fields that are named almost identically?
     
  5. vladimir-fs

    vladimir-fs

    Joined:
    Nov 28, 2019
    Posts:
    22
    Yup, it was a duplicate field,
    lobbyProcessing
    was unused,
    LobbyProcessing
    is still used.

    upload_2021-4-20_15-20-45.png

    After removing the unused field and rebuilding I'm still getting a crash. I'm sending you the .dmp file via PM.

    Is there a way for me to pinpoint offenders like this on my own? I would like to write an Editor script I could run in case something like this happens.

    EDIT: Also, why would these two fields clash? I'm guessing it's because the serializer or some part of the format being used for serialization isn't case sensitive?
     
    Last edited: Apr 20, 2021
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,505
    They don't clash. It seems that the second field data is not present, as if it was not there when the editor packaged the data.

    Regarding the editor script: it might be possible but likely not very simple. You'd need to compare the DLLs in your built game with ones under Library/ScriptAssemblies and see which fields are present in the former one but not the latter one.

    Generally, using #ifs for serializable fields is a no-no.
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,505
    Hmm, it still crashes on reading the "LobbyProcessing" field. Did you remove it from under the #if block? Are there any other scripts attached to the same gameobject that the "SteamPlatformManager" script is attached to?
     
  8. vladimir-fs

    vladimir-fs

    Joined:
    Nov 28, 2019
    Posts:
    22
    I didn't remove it, I removed the one above the #if block. The one below doesn't need to be serialized at all so I'm thinking of adding a
    [NonSerialized]
    attribute to it. That would fix it, right?

    Correct me if I'm wrong but this means that STEAM isn't defined when at compile time. This could mean other parts of the code are unavailable in the packaged build, right? That part worries me more. I'm testing what our defines look like at compile time right now.
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,505
    [NonSerialized] attribute would fix it. STEAM is defined in the game (otherwise it would not try to deserialize that field). It seems it's not defined in the editor (as the editor didn't package the data for that field).
     
  10. vladimir-fs

    vladimir-fs

    Joined:
    Nov 28, 2019
    Posts:
    22
    At what point should the flag be set for the Editor to pick it up?

    I'm looking at our build script and we're basically doing the following:
    • Load scenes (if not loaded already)
    • Get references to some of the objects in the scene (including the one SteamPlaftformManager is attached to)
    • Set define symbols
    • Use references to objects to set up stuff like available menu options, supported controllers, cloud save support etc.
    • Call BuildPipeline.BuildPlayer
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,505
    This could be a bug in Unity, I'd expect that to work.
     
  12. vladimir-fs

    vladimir-fs

    Joined:
    Nov 28, 2019
    Posts:
    22
    Just to double-check I did a print of
    PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone)
    just before
    BuildPipeline.BuildPlayer
    is called.
    STEAM
    is set as one of the defines in the string.

    I'm a bit confused by this part

    > It seems it's not defined in the editor (as the editor didn't package the data for that field).

    We're building via batchmode and calling to our build script. Is there another step we should take to setup our defines "on time" and in the editor?
     
    Last edited: Apr 23, 2021
  13. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,505
    So it turns out that SetScriptingDefineSymbolsForGroup triggers a domain reload so it doesn't take effect in the editor until your code returns, which causes the serialization system to serialize the data without that define. See this (it's addressables documentation but applies to this too): <SNIP>
     
    Last edited: Apr 26, 2021
  14. vladimir-fs

    vladimir-fs

    Joined:
    Nov 28, 2019
    Posts:
    22
    I'm unable to login to view the link you've posted. I used the same credentials to log into id.unity.com without issues just now to double-check.

    upload_2021-4-26_10-8-42.png

    EDIT: I've asked a colleague to try as well, and they cannot login either and get the same error.
     
    Last edited: Apr 26, 2021
  15. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,505
    I'm so sorry, that's an internal link.

    Here's the actual text in the documentation (I think it will be released publicly as part of the next addressables release):

    Can I build Addressables when recompiling scripts?
    If you have a pre-build step that triggers a domain reload, then you must take special care that the Addressables build itself does not start until after the domain reload is finished.

    Using methods such as setting scripting define symbols (PlayerSettings.SetScriptingDefineSymbolsForGroup) or switching active build target (EditorUserBuildSettings.SwitchActiveBuildTarget), triggers scripts to recompile and reload. The execution of the Editor code will continue with the currently loaded domain until the domain reloads and execution stops. Any platform dependant compilation or custom defines will not be set until after the domain reloads. This can lead to unexpected issues where code relies on these defines to build correctly, and can be easily missed.

    Best Practice
    When building via commandline arguments or CI, Unity recommends restarting the Editor for each desired platform using command line arguments. This ensures that scripts are compiled for a platform before -executeMethod is invoked.

    Is there a safe way to change scripts before building?
    To switch Platform, or modify Editor scripts in code and then continue with the defines set, a domain reload must be performed. Note in this case, -quit argument should not be used or the Editor will exit immediately after execution of the invoked method.

    When the domain reloads, InitialiseOnLoad is invoked. The code below demonstrates how to set scripting define symbols and react to those in the Editor code, building Addressables after the domain reload completes. The same process can be done for switching platforms and platform dependant compilation.

    Code (csharp):
    1. [InitializeOnLoad]
    2. public class BuildWithScriptingDefinesExample
    3. {
    4.    static BuildWithScriptingDefinesExample()
    5.    {
    6.        bool toBuild = SessionState.GetBool("BuildAddressables", false);
    7.        SessionState.EraseBool("BuildAddressables");
    8.        if (toBuild)
    9.        {
    10.            Debug.Log("Domain reload complete, building Addressables as requested");
    11.            BuildAddressablesAndRevertDefines();
    12.        }
    13.    }
    14.  
    15.    [MenuItem("Build/Addressables with script define")]
    16.    public static void BuildTest()
    17.    {
    18. #if !MYDEFINEHERE
    19.        Debug.Log("Setting up SessionState to inform an Addressables build is requested on next Domain Reload");
    20.        SessionState.SetBool("BuildAddressables", true);
    21.        string originalDefines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
    22.        string newDefines = string.IsNullOrEmpty(originalDefines) ? "MYDEFINEHERE" : originalDefines + ";MYDEFINEHERE";
    23.        Debug.Log("Setting Scripting Defines, this will then start compiling and begin a domain reload of the Editor Scripts.");
    24.        PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, newDefines);
    25. #endif
    26.    }
    27.  
    28.    static void BuildAddressablesAndRevertDefines()
    29.    {
    30. #if MYDEFINEHERE
    31.        Debug.Log("Correct scripting defines set for desired build");
    32.        AddressableAssetSettings.BuildPlayerContent();
    33.        string originalDefines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
    34.        if (originalDefines.Contains(";MYDEFINEHERE"))
    35.            originalDefines = originalDefines.Replace(";MYDEFINEHERE", "");
    36.        else
    37.            originalDefines = originalDefines.Replace("MYDEFINEHERE", "");
    38.        PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, originalDefines);
    39.        AssetDatabase.SaveAssets();
    40. #endif
    41.        EditorApplication.Exit(0);
    42.    }
    43. }
    44.  
     
  16. happyfirecn

    happyfirecn

    Joined:
    Dec 28, 2016
    Posts:
    11
    the same problem caused by SetScriptingDefineSymbolsForGroup and then build addressable in one call of commandline build, I will try seperate them.
     
  17. happyfirecn

    happyfirecn

    Joined:
    Dec 28, 2016
    Posts:
    11
    Hello,

    I followed the Best Practice, and sepearte my batchmode build to 3 steps, such as:

    Code (CSharp):
    1.  
    2. echo Switch Enviroment
    3. set log_path_1=%log_path%_1.txt
    4. %unity% -batchmode -nographics -executeMethod BuilderCommandline.Build_SwitchEnv -projectPath %proj_path% -logFile %log_path_1% -buildType:%BUILD_TYPE%
    5. if %errorlevel% neq 0 goto err
    6.  
    7. echo Build Assets
    8. set log_path_2=%log_path%_2.txt
    9. %unity% -batchmode -quit -nographics -executeMethod BuilderCommandline.Build_MakeAssets -projectPath %proj_path% -logFile %log_path_2% -buildType:%BUILD_TYPE%
    10. if %errorlevel% neq 0 goto err
    11.  
    12. echo Make Package
    13. set log_path_3=%log_path%_3.txt
    14. %unity% -batchmode -quit -nographics -executeMethod BuilderCommandline.Build_MakePackage -projectPath %proj_path% -logFile %log_path_3% -buildType:%BUILD_TYPE%
    15. if %errorlevel% neq 0 goto err
    In the first call, I will use SetScriptingDefineSymbolsForGroup to set defines accroding to %BUILD_TYPE%, and after that, call EditorApplication.Exit(0) to exit. (or use -quit on the command line)

    In the second call, just build the addressable by calling AddressableAssetSettings.BuildPlayerContent.

    And in the final call, just build the player by calling BuildPipeline.BuildPlayer.

    It works serveral days, but today I encountered the "level 0 is corrupted" crash again and again.
    The level 0 is the Steam start scene with scrips define enabled by BUILD_TYPE.

    Is there anyting wrong of me? Thanks!


     
  18. MarcBaques

    MarcBaques

    Joined:
    Aug 19, 2021
    Posts:
    14
    Do you have any update on this? We have the same problem and we are gonna try to split the process as stated.
     
  19. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    You can fix this by not having serializable fields/classes inside #if blocks. When you do so you risk your data layout being different if the defines are different between building the assets and building the player itself.
     
    happyfirecn and MarcBaques like this.