Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

Discussion in 'Scripting' 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. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    That does feel like code stripping. Remember with IL2CPP code stripping can happen at more than one spot: the IL generation, then the actual C++ linking step. I think link.xml only controls the former. Try maybe making some static references to the thing that goes missing?
     
  3. opacicpetar96

    opacicpetar96

    Joined:
    Nov 20, 2019
    Posts:
    26
    Thanks for the response,
    Can you please show some sample code on how to reference these functions statically?
     
  4. opacicpetar96

    opacicpetar96

    Joined:
    Nov 20, 2019
    Posts:
    26