Search Unity

IL2CPP crashes at GarbageCollectSharedAssets and LoadLevel

Discussion in 'iOS and tvOS' started by C0MPLETE, Apr 6, 2015.

  1. C0MPLETE

    C0MPLETE

    Joined:
    Apr 6, 2015
    Posts:
    5
    Hi, everyone.

    I'm developing an iOS App. But it is crashed at 'GarbageCollectSharedAssets' and 'LoadLevel'.
    The version of Unity is 4.6.4 p1 and scripting backend is IL2CPP.
    I read that the crash (scripting backend is Mono) is fixed.
    But if the scripting backend is IL2CPP, how to resolve the crash?

     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Welcome to the forum!

    Did you submit a bug report?
     
  3. C0MPLETE

    C0MPLETE

    Joined:
    Apr 6, 2015
    Posts:
    5
    Of course.
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @C0MPLETE

    Can you let me know the bug number? That way I can take a brief look and see if there is a work around we can provide before we can get this bug fixed. Thanks.
     
  5. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    When you post in the forum, you should always post the case number of the bug in the case that someone from Unity finds it, such that it is easy for them to investigate the bug.

    Edit: Was too slow :)
     
  6. C0MPLETE

    C0MPLETE

    Joined:
    Apr 6, 2015
    Posts:
    5
    The bug number is 687036 I reported. But I didn't attach whole project because it is too heavy.
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @C0MPLETE

    Thanks for submitting the bug. I don't know of a work around now, unfortunately. We may need the project to help reproduce this case. We have a few other ways to obtain a large project, so our QA team will likely contact you when they process the bug report.
     
  8. ainijiujiu

    ainijiujiu

    Joined:
    Mar 20, 2015
    Posts:
    1
    Did you slove?
     
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @ainijiujiu

    No, we have not yet investigated this issue. If are seeing the same problem and can provide a smaller project to reproduce it. That will help us. If so, please submit a different bug report and include the project. Thanks!
     
  10. C0MPLETE

    C0MPLETE

    Joined:
    Apr 6, 2015
    Posts:
    5
    Recently, When I updated all of assetbundles in project, the crash doesn't occured. I expected that the problem is the sync of the app and assetbundles. Thanks!
     
  11. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @C0MPLETE

    Excellent, thanks for letting us know. Can you tell us specific what you updated? Maybe others are facing a similar problem.
     
  12. big_march

    big_march

    Joined:
    Mar 2, 2015
    Posts:
    38
    I got the same crash in Unity4.6.4P4.
    This crash occurred when LoadLevel(). It seems that only occurred on ARMV7 device.(iPad mini and iPhone 5)
    Have you resolve this in the newer version unity3d?


    @JoshPeterson

    Code (CSharp):
    1. * thread #1: tid = 0xccf81, 0x01fa634c warwings`il2cpp::vm::LivenessState::AddProcessObject(object=0x00916964, state=0x1dc6c280) + 48 at Liveness.cpp:309, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xe92d4176)
    2.   * frame #0: 0x01fa634c warwings`il2cpp::vm::LivenessState::AddProcessObject(object=0x00916964, state=0x1dc6c280) + 48 at Liveness.cpp:309
    3.     frame #1: 0x01fa5f08 warwings`il2cpp::vm::LivenessState::TraverseGenericObject(Il2CppObject*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseGCDescriptor(Il2CppObject*, il2cpp::vm::LivenessState*) + 24 at Liveness.cpp:191
    4.     frame #2: 0x01fa5ef0 warwings`il2cpp::vm::LivenessState::TraverseGenericObject(object=0x0277dde8, state=0x1dc6c280) + 48 at Liveness.cpp:163
    5.     frame #3: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    6.     frame #4: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0e203260, state=0x1dc6c280) + 380 at Liveness.cpp:299
    7.     frame #5: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    8.     frame #6: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0e203130, state=0x1dc6c280) + 380 at Liveness.cpp:299
    9.     frame #7: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    10.     frame #8: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0e29ae00, state=0x1dc6c280) + 380 at Liveness.cpp:299
    11.     frame #9: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    12.     frame #10: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0ca67aa0, state=0x1dc6c280) + 380 at Liveness.cpp:299
    13.     frame #11: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    14.     frame #12: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0d8cd000, state=0x1dc6c280) + 380 at Liveness.cpp:299
    15.     frame #13: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    16.     frame #14: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0cca1000, state=0x1dc6c280) + 380 at Liveness.cpp:299
    17.     frame #15: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    18.     frame #16: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0e203000, state=0x1dc6c280) + 380 at Liveness.cpp:299
    19.     frame #17: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    20.     frame #18: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0d0e3000, state=0x1dc6c280) + 380 at Liveness.cpp:299
    21.     frame #19: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    22.     frame #20: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0e29ac40, state=0x1dc6c280) + 380 at Liveness.cpp:299
    23.     frame #21: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    24.     frame #22: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0e68c550, state=0x1dc6c280) + 380 at Liveness.cpp:299
    25.     frame #23: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    26.     frame #24: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0e44c800, state=0x1dc6c280) + 380 at Liveness.cpp:299
    27.     frame #25: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    28.     frame #26: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x12c43000, state=0x1dc6c280) + 380 at Liveness.cpp:299
    29.     frame #27: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    30.     frame #28: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0d0e3390, state=0x1dc6c280) + 380 at Liveness.cpp:299
    31.     frame #29: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    32.     frame #30: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0e203980, state=0x1dc6c280) + 380 at Liveness.cpp:299
    33.     frame #31: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    34.     frame #32: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0d0e3130, state=0x1dc6c280) + 380 at Liveness.cpp:299
    35.     frame #33: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    36.     frame #34: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0db56900, state=0x1dc6c280) + 380 at Liveness.cpp:299
    37.     frame #35: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    38.     frame #36: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0db56240, state=0x1dc6c280) + 380 at Liveness.cpp:299
    39.     frame #37: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    40.     frame #38: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0d987480, state=0x1dc6c280) + 380 at Liveness.cpp:299
    41.     frame #39: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    42.     frame #40: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0db56b40, state=0x1dc6c280) + 380 at Liveness.cpp:299
    43.     frame #41: 0x01fa6154 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    44.     frame #42: 0x01fa6144 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0e68c000, state=0x1dc6c280) + 272 at Liveness.cpp:287
    45.     frame #43: 0x01fa61c0 warwings`il2cpp::vm::LivenessState::TraverseArray(Il2CppArray*, il2cpp::vm::LivenessState*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 16 at Liveness.cpp:129
    46.     frame #44: 0x01fa61b0 warwings`il2cpp::vm::LivenessState::TraverseArray(array=0x0e203390, state=0x1dc6c280) + 380 at Liveness.cpp:299
    47.     frame #45: 0x01fa6a34 warwings`il2cpp::vm::Liveness::FromStatics(void*) [inlined] il2cpp::vm::LivenessState::TraverseGenericObject(Il2CppObject*, il2cpp::vm::LivenessState*) + 84 at Liveness.cpp:167
    48.     frame #46: 0x01fa69e0 warwings`il2cpp::vm::Liveness::FromStatics(void*) [inlined] il2cpp::vm::LivenessState::TraverseObjects() + 40 at Liveness.cpp:129
    49.     frame #47: 0x01fa69b8 warwings`il2cpp::vm::Liveness::FromStatics(state=0x1dc6c280) + 392 at Liveness.cpp:455
    50.     frame #48: 0x0197fc20 warwings`GarbageCollectSharedAssets(bool) [inlined] MarkManagedStaticVariableRoots(gcState=0xffffffff) + 1928 at GarbageCollectSharedAssets.cpp:496
    51.     frame #49: 0x0197fc04 warwings`GarbageCollectSharedAssets(monoReferences=<unavailable>) + 1900 at GarbageCollectSharedAssets.cpp:242
     
  13. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @big_march

    We've not yet had a project which can reproduce this issue, so if you can provide one, we would greatly appreciate it. I don't think this is a crash that we will easily be able to track down without being able to reproduce it.
     
  14. big_march

    big_march

    Joined:
    Mar 2, 2015
    Posts:
    38
    Test in Unity4.6.5f1, this crash didn't occurred again.
     
  15. VoxelBoy

    VoxelBoy

    Joined:
    Nov 7, 2008
    Posts:
    240
    @JoshPeterson

    Hey,
    I just had this occur with an iOS build from Unity 5.1.3p3. Should I submit it as a bug report? Is sending over just the XCode project enough? Thanks.
     
  16. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @VoxelBoy

    There is no need for a bug report, we have a correction internally for this issue. It will be corrected in the 5.1.4 release next week. I would recommend falling back to 5.1.3p2, where this bug does not occur, if possible.

    If you need something else that is in 5.1.3p3, I can send you a link to a pre-release version of 5.1.4 that has this fix. PIng me via a conversation if you need that link.
     
  17. caecus

    caecus

    Joined:
    Nov 27, 2012
    Posts:
    3
    @JoshPeterson

    Would this issue affected 4.6.8p2 ? We upgraded to fix the ios9 font issues, but now are crashing on boot with something that looks very much like this bug.

    What version of 4.6 should we rollback to ?

    Code (CSharp):
    1. Thread : Crashed: com.apple.main-thread
    2. 0  ScrapForceOmega                0x00000001013584c8  + 4315137224
    3. 1  ScrapForceOmega                0x0000000101181570 il2cpp::vm::Liveness::Begin(TypeInfo*, int, void (*)(void**, int, void*), void*, void (*)(), void (*)()) (Liveness.cpp:467)
    4. 2  ScrapForceOmega                0x0000000100cbea8c GarbageCollectSharedAssets(bool) (GarbageCollectSharedAssets.cpp:470)
    5. 3  ScrapForceOmega                0x0000000100cd35a8 CleanupAfterLoad() (SaveAndLoadHelper.cpp:518)
    6. 4  ScrapForceOmega                0x0000000100cc18c8 LevelLoading::LoadLevel(int, std::string const&, AwakeFromLoadQueue&) (Player.cpp:1361)
    7. 5  ScrapForceOmega                0x0000000100cc65a0 PreloadLevelOperation::IntegrateMainThread() (PreloadManager.cpp:796)
    8. 6  ScrapForceOmega                0x0000000100cc54d8 PreloadManager::UpdatePreloadingSingleStep(bool) (ThreadUtility.h:54)
    9. 7  ScrapForceOmega                0x0000000100cc5e1c PreloadManager::WaitForAllAsyncOperationsToComplete() (PreloadManager.cpp:555)
    10. 8  ScrapForceOmega                0x0000000100cc2e8c PlayerLoop(bool, bool, IHookEvent*) (Player.cpp:1800)
    11. 9  ScrapForceOmega                0x0000000100ad3d78 UnityPlayerLoop (LibEntryPoint.mm:253)
    12. 10 ScrapForceOmega                0x00000001000ce30c UnityRepaintImpl(bool) (UnityAppController+Rendering.mm:225)
    13. 11 ScrapForceOmega                0x00000001000cdc50 __51-[UnityAppController(Rendering) repaintDisplayLink]_block_invoke (UnityAppController+Rendering.mm:55)
    14. 12 libdispatch.dylib              0x0000000198981994 _dispatch_call_block_and_release + 24
    15. 13 libdispatch.dylib              0x0000000198981954 _dispatch_client_callout + 16
    16. 14 libdispatch.dylib              0x000000019898620c _dispatch_main_queue_callback_4CF + 1608
    17. 15 CoreFoundation                 0x0000000186647544 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
    18. 16 CoreFoundation                 0x00000001866455ec __CFRunLoopRun + 1492
    19. 17 CoreFoundation                 0x0000000186570f74 CFRunLoopRunSpecific + 396
    20. 18 GraphicsServices               0x000000018ffd36fc GSEventRunModal + 168
    21. 19 UIKit                          0x000000018b172d94 UIApplicationMain + 1488
    22. 20 ScrapForceOmega                0x00000001000ca15c main (main.mm:37)
    23. 21 libdyld.dylib                  0x00000001989aea08 start + 4
     
  18. nsejosh

    nsejosh

    Joined:
    Nov 16, 2012
    Posts:
    7
    @JoshPeterson Hi! Will the 4.6.8 patch that fixes this be coming out next week as well? We can't rollback to an older version because of the iOS 9 unicode bug, and we can't use this version because of the crash. Please help, you're our only hope! If you have a link to the prerelease version of 4.6.8 with the fix we'd love to try that over the weekend- we're on a very tight release schedule. Thanks!
    Josh
     
  19. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @caecus @nsejosh

    We have any early version of 4.6.8p3 which corrects this issue available here:

    Revision: 5edf5b4fd05e
    Version: 4.6.8p3
    MAC: http://beta.unity3d.com/download/5683418501/unity_update-4.6.8p3.dmg
    (md5sum=4dcf4801f1e44f8ab7b6251a20cb5556)
    PC: http://beta.unity3d.com/download/5683418501/UnitySetup_update-4.6.8p3.exe
    (md5sum=35b0e9fec080d0208fd6703d738f37c0)

    The problem did occur only in 4.6.8p2 (in the 4.6 series). We'll have the final 4.6.8p3 release with more changes available next week, so please upgrade to that when it is available.
     
    r618 likes this.
  20. N-i-x

    N-i-x

    Joined:
    Jan 27, 2014
    Posts:
    5
    Hi,

    We have similar crash with "Application.LoadLevelAsync" and the P3 you provided does not fix the issue :(
    Btw, this version is 4.6.8p2 from sept 10th (72e1c4081d0). I re-installed many times, it's not a P3 and/or the revision is not 5edf5b4fd05e

    Regards

    Nicolas
     
  21. mark71

    mark71

    Joined:
    Jun 14, 2015
    Posts:
    41
    I saw reports about 5.1.x and 4.6.x, does 5.2.0p1 have this bug?
     
  22. N-i-x

    N-i-x

    Joined:
    Jan 27, 2014
    Posts:
    5
    No issue for us with 5.2.0p1
     
  23. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    I reported a bug on another thread that seems related to this. Would be possible please share the link to the pre-release of 5.1.4? Thanks
     
  24. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @N.i.x

    It sounds like you are seeing a related, but different issue. Can you submit a bug report for the problem you are seeing? That will help us track it down.
     
  25. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @N.i.x @mark71

    That is correct, the problem does not occur in 5.2.0p1.
     
  26. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @Wagenheimer

    Chat me privately via a conversation, and I'll share the 5.1.4 pre-release link. Note that the official 5.1.4 build with this fix should be out soon (this week) as well.
     
    yuliyF likes this.
  27. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    197
    I have this bug in 5.1.3p3 in webGL
     
  28. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @yuliyF

    Yes, this bug can occur in WebGL as well. ping me privately if you would like access to the 5.1.4 pre-release version.
     
  29. duong-tranthai

    duong-tranthai

    Joined:
    Jan 5, 2016
    Posts:
    15
    I have this bug in 5.3.x
     
  30. Kevin_Deng

    Kevin_Deng

    Joined:
    Dec 16, 2013
    Posts:
    2
    I have this bug in 4.7.1f1
     
  31. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @Kevin_Deng

    I think that this specific issue was corrected in 4.6.8p3, so you should not be seeing it in 4.7.1f1. Although maybe there is another related issue. Can you provide a full call stack for the crash you see?
     
  32. Tetsuya_OYA

    Tetsuya_OYA

    Joined:
    Jul 20, 2013
    Posts:
    13

    I have this bug in 5.3.3f1.
    I post screen capture of stack trace in xcode.
     

    Attached Files:

  33. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @KurtCobain

    The call stack in this looks slightly different from the others in this thread, so it might be caused by a different issue. If you can, please try with the latest version of Unity (5.3.5f1 now). If that doesn't work, can you submit a bug report?
     
  34. Tetsuya_OYA

    Tetsuya_OYA

    Joined:
    Jul 20, 2013
    Posts:
    13
    I tryed 5.3.5f1, but same result... I will submit a bug report. thank you.
     
  35. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @KurtCobain

    Thanks. Please let me know the bug report number when it is submitted.
     
  36. Tetsuya_OYA

    Tetsuya_OYA

    Joined:
    Jul 20, 2013
    Posts:
    13
    Its #814124.
     
  37. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @KurtCobain

    Thanks, we will investigate this bug report.
     
  38. Tetsuya_OYA

    Tetsuya_OYA

    Joined:
    Jul 20, 2013
    Posts:
    13
    I reported this bug from Unity 5.3.5f1 (newest version).
    I attemped porject folder and Supplemental movie.
    Bug report number is #815126.
     
  39. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @KurtCobain

    Thanks, we will investigate this issue.
     
  40. hannibald

    hannibald

    Joined:
    Dec 14, 2016
    Posts:
    2
    Hi~~
    so the #815126 issue is sovled?
     
  41. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @hannibald

    The issue is solved, at least in the sense that we understand the problem.

    Actually, this is not a bug, but rather a bad interaction between the asset bundle system and engine code stripping in Unity. The two systems do not play well together. To prevent the crash from occurring, disable engine code stripping in the Player Settings in this project.

    When engine code stripping is enabled, the stripping system will remove any engine code types that are not used by any scene in the build. However, if one or more of those types is used by an asset bundle, then the asset bundle will not be able to properly load that engine code type in the player, since it has not been stripped. So it is best to disable engine code stripping when asset bundles are in use.

    In the Unity 5.5 release we have improved this situation, allowing the stripping system to be informed about which asset bundles will be used at runtime, and preserve all engine code types used in any of those asset bundles.
     
  42. hannibald

    hannibald

    Joined:
    Dec 14, 2016
    Posts:
    2
    It done!
    Thank you a lot!
     
  43. Gerold_Meisinger

    Gerold_Meisinger

    Joined:
    Sep 8, 2015
    Posts:
    93
    For anyone still suffering from this error we had to remove a call to "Resources.UnloadUnusedAssets()" in one of our plugins.
     
  44. ropemonkey

    ropemonkey

    Joined:
    Apr 28, 2014
    Posts:
    6
    I had a similar experience with one of our plugins in both Unity 5.6 and 2017.2.
     
  45. SherryGuo

    SherryGuo

    Joined:
    Apr 26, 2017
    Posts:
    1
  46. zhujiangbo

    zhujiangbo

    Joined:
    Nov 25, 2013
    Posts:
    6
    hi, i get a related crash on pc standalone buiding player with 2018.4.0f1 (b6ffa8986c8d)

    i converted excel tables to scriptable assets, and packed them in a bundle. i load the bundle and assets in runtime. all is ok in unity editor. but it crashed in building player when i load level additive or call "Resources.UnloadUnusedAssets()".

    please help, i am using 2018.4.0f1 (b6ffa8986c8d)

    the call stack:
    0x000007FECCE5BCBA (mono-2.0-bdwgc) mono_object_is_alive
    0x000007FECCE5C6B6 (mono-2.0-bdwgc) mono_unity_liveness_calculation_from_statics
    0x000007FEC8AC33FE (UnityPlayer) GarbageCollectSharedAssets
    0x000007FEC8AE4366 (UnityPlayer) UnloadUnusedAssetsOperation::IntegrateMainThread
    0x000007FEC8AE6AF7 (UnityPlayer) PreloadManager::UpdatePreloadingSingleStep
    0x000007FEC8AE687D (UnityPlayer) PreloadManager::UpdatePreloading
    0x000007FEC8AD1746 (UnityPlayer) `InitPlayerLoopCallbacks'::`2'::EarlyUpdateUpdatePreloadingRegistrator::Forward
    0x000007FEC8AC2A6E (UnityPlayer) ExecutePlayerLoop
    0x000007FEC8AC2B3F (UnityPlayer) ExecutePlayerLoop
    0x000007FEC8AC5AE0 (UnityPlayer) PlayerLoop
    0x000007FEC853E722 (UnityPlayer) PerformMainLoop
    0x000007FEC853CD9A (UnityPlayer) MainMessageLoop
    0x000007FEC8541DD6 (UnityPlayer) UnityMainImpl
    0x000007FEC85441CB (UnityPlayer) UnityMain
    0x000000013FEB11FA (Sandrock) __scrt_common_main_seh
    0x00000000771259CD (kernel32) BaseThreadInitThunk
    0x00000000774C383D (ntdll) RtlUserThreadStart
     
  47. zhujiangbo

    zhujiangbo

    Joined:
    Nov 25, 2013
    Posts:
    6
    @JoshPeterson please help,no il2cpp, Managed Stripping Level is Disabled in Player Settings
     
    Last edited: Jun 10, 2019
  48. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @zhujiangbo

    This looks like it might be a different issue from the original one in this thread. The original issue was solved by disabling the Strip Engine Code option, which is different from the Managed Stripping Level option. You indicated that you are using the Mono scripting backend, and Strip Engine Code option is not available with the Mono Scripting backend.

    I'd recommend that you submit a bug report for this problem, and include the project that causes it. It looks like something we should investigate more.
     
  49. zhujiangbo

    zhujiangbo

    Joined:
    Nov 25, 2013
    Posts:
    6
    @JoshPeterson
    Yes, i have solve the problem, but i don't no how it cause the crash.
    i have a script like this:

    using System.Runtime.InteropServices;
    using UnityEngine;

    namespace Pathea.OptionNs
    {
    public enum DataType : byte
    {
    Int,
    Float,
    Bool,
    String,
    Vec2Int,
    Vec2,
    Max
    }

    [StructLayout(LayoutKind.Explicit)]
    public struct Value
    {
    [FieldOffset(0)]
    public int valueInt;

    [FieldOffset(0)]
    public float valueFloat;

    [FieldOffset(0)]
    public string valueString;

    [FieldOffset(0)]
    public bool valueBool;

    [FieldOffset(0)]
    public Vector2Int valueIntVec2;

    [FieldOffset(0)]
    public Vector2 valueVector2;

    public void Reset()
    {
    valueIntVec2 = Vector2Int.zero;
    }
    }

    public class OptionSlot
    {
    private DataType Type;

    private string Key;

    private Value value;

    /// <summary>
    /// 明确设置类型,以免错误
    /// </summary>
    /// <param name="key"></param>
    /// <param name="type"></param>
    /// <param name="valueBool"></param>
    public OptionSlot(string key, DataType type, bool value)
    {
    this.Init(key, type);
    SetValue(value);
    }

    public OptionSlot(string key, DataType type, float value)
    {
    this.Init(key, type);
    SetValue(value);
    }

    public OptionSlot(string key, DataType type, int value)
    {
    this.Init(key, type);
    SetValue(value);
    }

    public OptionSlot(string key, DataType type, string value)
    {
    this.Init(key, type);
    SetValue(value);
    }

    public OptionSlot(string key, DataType type, Vector2 value)
    {
    this.Init(key, type);
    SetValue(value);
    }

    public OptionSlot(string key, DataType type, Vector2Int value)
    {
    this.Init(key, type);
    SetValue(value);
    }

    public OptionSlot(string key, DataType type)
    {
    this.Init(key, type);
    }

    private void Init(string key, DataType type)
    {
    this.Key = key;
    this.Type = type;

    this.value.Reset();
    }

    public int GetInt()
    {
    if (Type != DataType.Int)
    {
    throw new System.Exception("type should be:" + Type);
    }

    return value.valueInt;
    }

    public float GetFloat()
    {
    if (Type != DataType.Float)
    {
    throw new System.Exception("type should be:" + Type);
    }

    return value.valueFloat;
    }

    public bool GetBool()
    {
    if (Type != DataType.Bool)
    {
    throw new System.Exception("type should be:" + Type);
    }

    return value.valueBool;
    }

    public string GetString()
    {
    if (Type != DataType.String)
    {
    throw new System.Exception("type should be:" + Type);
    }

    return value.valueString;
    }

    public Vector2Int GetVector2Int()
    {
    if (Type != DataType.Vec2Int)
    {
    throw new System.Exception("type should be:" + Type);
    }

    return value.valueIntVec2;
    }

    public Vector2 GetVector2()
    {
    if (Type != DataType.Vec2)
    {
    throw new System.Exception("type should be:" + Type);
    }

    return value.valueVector2;
    }

    public void SetValue(int value)
    {
    if (Type != DataType.Int)
    {
    throw new System.Exception("type should be:"+Type);
    }

    this.value.valueInt = value;
    }

    public void SetValue(float value)
    {
    if (Type != DataType.Float)
    {
    throw new System.Exception("type should be:" + Type);
    }

    this.value.valueFloat = value;
    }

    public void SetValue(bool value)
    {
    if (Type != DataType.Bool)
    {
    throw new System.Exception("type should be:" + Type);
    }

    this.value.valueBool = value;
    }

    public void SetValue(string value)
    {
    if (Type != DataType.String)
    {
    throw new System.Exception("type should be:" + Type);
    }

    this.value.valueString = value;
    }

    public void SetValue(Vector2Int value)
    {
    if (Type != DataType.Vec2Int)
    {
    throw new System.Exception("type should be:" + Type);
    }

    this.value.valueIntVec2 = value;
    }

    public void SetValue(Vector2 value)
    {
    if (Type != DataType.Vec2)
    {
    throw new System.Exception("type should be:" + Type);
    }

    this.value.valueVector2 = value;
    }

    public void SetValue(object value)
    {
    switch (Type)
    {
    case DataType.Int:
    SetValue((int)value);
    break;

    case DataType.Float:
    SetValue((float)value);

    break;

    case DataType.Bool:
    SetValue((bool)value);
    break;

    case DataType.String:
    SetValue(value as string);
    break;

    case DataType.Vec2Int:
    SetValue((Vector2Int)value);
    break;

    case DataType.Vec2:
    SetValue((Vector2)value);
    break;

    default:
    break;
    }
    }


    public void Load()
    {
    switch (Type)
    {
    case DataType.Int:
    value.valueInt = GetInt(Key, value.valueInt);
    break;

    case DataType.Float:
    value.valueFloat = GetFloat(Key, value.valueFloat);

    break;

    case DataType.String:
    value.valueString = GetString(Key, value.valueString);

    break;

    case DataType.Bool:

    if (PlayerPrefs.HasKey(Key))
    {
    var b = GetInt(Key, 0);

    value.valueBool = b > 0 ? true : false;
    }

    break;

    case DataType.Vec2Int:
    value.valueIntVec2.x = GetInt(Key + "_X", value.valueIntVec2.x);
    value.valueIntVec2.y = GetInt(Key + "_Y", value.valueIntVec2.y);
    break;

    case DataType.Vec2:
    value.valueVector2.x = GetFloat(Key + "_X", value.valueVector2.x);
    value.valueVector2.y = GetFloat(Key + "_Y", value.valueVector2.y);
    break;

    default:
    break;
    }
    }

    public void Save()
    {
    switch (Type)
    {
    case DataType.Int:
    SetInt(Key, value.valueInt);
    break;

    case DataType.Float:
    SetFloat(Key, value.valueFloat);

    break;

    case DataType.String:
    SetString(Key, value.valueString);

    break;

    case DataType.Bool:
    SetInt(Key, value.valueBool ? 1 : 0);
    break;

    case DataType.Vec2Int:
    SetInt(Key + "_X", value.valueIntVec2.x);
    SetInt(Key + "_Y", value.valueIntVec2.y);
    break;

    case DataType.Vec2:
    SetFloat(Key + "_X", value.valueVector2.x);
    SetFloat(Key + "_Y", value.valueVector2.y);
    break;

    default:
    break;
    }
    }

    private static void SetInt(string key, int value)
    {
    PlayerPrefs.SetInt(key, value);
    }

    private static int GetInt(string key, int defaultValue)
    {
    return PlayerPrefs.GetInt(key, defaultValue);
    }

    private static void SetFloat(string key, float value)
    {
    PlayerPrefs.SetFloat(key, value);
    }

    private static float GetFloat(string key, float defaultValue)
    {
    return PlayerPrefs.GetFloat(key, defaultValue);
    }

    private static void SetString(string key, string value)
    {
    PlayerPrefs.SetString(key, value);
    }

    private static string GetString(string key, string defaultValue)
    {
    return PlayerPrefs.GetString(key, defaultValue);
    }
    }
    }

    there are some codes in another script:
    public partial class OptionMgr
    {
    private OptionSlot[] optionSlots;
    private OptionSlot Voice;
    public void Init()
    {
    optionSlots = new OptionSlot[]
    {
    Voice = new OptionSlot("Sound_Enable", DataType.Bool, true),
    };
    }
    }

    building player crashed when the init() was called.

    i solved the problem by deleting "[StructLayout(LayoutKind.Explicit)]" and "[FieldOffset(0)]" in the Value class.
     
  50. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Your work around is correct. Unfortunately, Unity does not support overlapping fields (the "[FieldOffset(0)]" attribute) where some of the fields are value types (like the valueInt field) and some of the fields are reference types (like the valueString field).