Search Unity

Resolved Unable to find UnityEngine.Jobs function crash while running on iOS

Discussion in 'Burst' started by opacicpetar96, May 13, 2021.

  1. opacicpetar96

    opacicpetar96

    Joined:
    Nov 20, 2019
    Posts:
    26
    Hello!

    It looks like I'm having an IL2CPP issue. When building my mobile project to iOS, the build is successful but when the game starts on the device I'm getting this error in the Xcode:

    Code (CSharp):
    1. Built from '2020.2/release' branch, Version '2020.2.1f1 (270dd8c3da1c)', Build type 'Release', Scripting Backend 'il2cpp'
    2. -> applicationDidFinishLaunching()
    3. -> applicationDidBecomeActive()
    4. [Subsystems] Discovering subsystems at path /private/var/containers/Bundle/Application/DB3C1834-26D7-4845-BECA-852578AAB044/Buzzy.app/Data/UnitySubsystems
    5. GfxDevice: creating device client; threaded=1
    6. Initializing Metal device caps: Apple A10 GPU
    7. Initialize engine version: 2020.2.1f1 (270dd8c3da1c)
    8. 2021-05-11 14:47:50.829744+0200 Buzzy[1582:173281] Unbalanced calls to begin/end appearance transitions for <UnityViewControllerStoryboard: 0x127f776f0>.
    9. UnloadTime: 2.462500 ms
    10. Unable to find internal function `UnityEngine.Jobs.TransformAccess::GetWorldToLocalMatrix`
    11. Unity.Burst.BurstCompilerHelper:IsCompiledByBurst(Delegate)
    12. Unity.Burst.BurstCompilerHelper:.cctor()
    13. Unity.Burst.BurstCompiler:Compile(T, Boolean)
    14. Unity.Entities.ComponentSystemGroup:.cctor()
    15. Unity.Entities.InitializationSystemGroup:.ctor()
    16. System.Reflection.MonoCMethod:InternalInvoke(Object, Object[])
    17. System.Activator:CreateInstance(Type, Boolean)
    18. Unity.Entities.TypeManager:ConstructSystem(Type)
    19. Unity.Entities.World:CreateSystemInternal(Type)
    20. Unity.Entities.World:GetOrCreateSystem()
    21. Unity.Entities.DefaultWorldInitialization:AddSystemToRootLevelSystemGroupsInternal(World, IEnumerable`1, Int32)
    22. Unity.Entities.DefaultWorldInitialization:Initialize(String, Boolean)
    23. Unity.Entities.AutomaticWorldBootstrap:Initialize()
    I'm using Unity 2020.2.1f1.
    I looked around on the web and found some similar threads and most of them suggested adding an link.xml file to the assets folder. I did that and my xml looks like this:

    Code (CSharp):
    1. <linker>
    2.   <assembly fullname="Unity.Collections" preserve="all" />
    3.   <assembly fullname="Unity.Collections.Tests" preserve="all" />
    4.   <assembly fullname="Unity.Burst.Tests" preserve="all" />
    5.   <assembly fullname="Unity.Transforms" preserve="all" />
    6.   <assembly fullname="Unity.Transforms.Hybrid" preserve="all" />
    7.   <assembly fullname="Unity.Transforms.Tests" preserve="all" />
    8.   <assembly fullname="Unity.Jobs" preserve="all" />
    9.   <assembly fullname="Unity.Jobs.Tests" preserve="all" />
    10.   <assembly fullname="UnityEngine.Jobs" preserve="all" />
    11.   <assembly fullname="UnityEngine.Jobs.TransformAccess" preserve="all" />
    12.   <assembly fullname="Unity.Burst" preserve="all" />
    13.   <assembly fullname="Unity.Entities" preserve="all" />
    14. </linker>
    15.  
    But this didn't solve the issue either. Some other things I tried out:
    - Disabling Strip Engine Code
    - Updating Jobs and Burst packages
    - Enabling/Disabling Burst compilation
    None of these worked. :(

    I can also reproduce this issue if I build my project to android with IL2CPP scripting backend. If I build it to Android with Mono scripting backend, it works like a charm...

    Any idea how to fix this issue?
     
  2. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    Could you submit a repro for us? I've never seen this, and asked around and no-one I've managed to catch has anything paged in their heads for what could cause this.
     
  3. opacicpetar96

    opacicpetar96

    Joined:
    Nov 20, 2019
    Posts:
    26
    After almost a week of struggles and a lot of debugging I found the problem. In short, the crash was caused by the Unity.Entities 0.17.0-preview.41 package. (ref https://docs.unity3d.com/Packages/com.unity.entities@0.17/manual/index.html)

    Even if an empty project is built on IL2CPP scripting backend + Development build is unchecked and the above mentioned Entities preview package is installed the app will crash and you will probably get the same error as me.

    I don't know if it was a code stripping error after all but I found out a strange thing, if the Entities preview package is enabled it's first in the Script Execution Order (which you can check in the Project Settings) and maybe that caused the issue of a missing Internal function. (as the Entities package is dependent on the UnityEngine.Jobs.TransformAccess but as the Entities package executes first, it can't find the Jobs yet, that's my logic behind this, but please correct me if I'm wrong)

    I'm still not sure why I had that package installed in the first place, as I didn't even use it in this project, so removing it solved all my issues and the project now runs smooth. Maybe this will help someone who has a similar issue in the future. All I can say as conclusion is:

    1. Be careful with preview packages.
    2. Don't use Unity.Entities preview package until they fix this issue.
     
    sheredom and mmonly like this.
  4. Martin_Kipirko

    Martin_Kipirko

    Joined:
    Dec 5, 2014
    Posts:
    3
    Same issue for me if use any of this packages:

    "com.unity.dataflowgraph": "0.19.0-preview.7",
    "com.unity.dots.editor": "0.12.0-preview.6",
    "com.unity.entities": "0.17.0-preview.42",
    "com.unity.physics": "0.6.0-preview.3",
    "com.unity.rendering.hybrid": "0.11.0-preview.44",
     
  5. StayThirsty

    StayThirsty

    Joined:
    Jul 6, 2013
    Posts:
    42
    Android also crashes from the same error:
    Code (CSharp):
    1. Error Unity Unable to find internal function `UnityEngine.Jobs.TransformAccess::GetWorldToLocalMatrix`
    When using IL2CPP and ECS 0.17.0-preview.42
    Unity 2021.2.0b16.3733