juicycleff / flutter-unity-view-widget

Embeddable unity game engine view for Flutter. Advance demo here https://github.com/juicycleff/flutter-unity-arkit-demo
BSD 3-Clause "New" or "Revised" License
2.13k stars 518 forks source link

L2CPP initialization failed #868

Closed dnkoulouris closed 1 year ago

dnkoulouris commented 1 year ago

When running the project on IOS, the following message is displayed and is followed by a crash.

Built from '2021.3/staging' branch, Version '2021.3.10f1 (1c7d0df0160b)', Build type 'Release', Scripting Backend 'il2cpp'
no boot config - using default values
MemoryManager: Using 'Default' Allocator.
[UnityMemory] Configuration Parameters - Can be set up in boot.config
    "memorysetup-bucket-allocator-granularity=16"
    "memorysetup-bucket-allocator-bucket-count=8"
    "memorysetup-bucket-allocator-block-size=4194304"
    "memorysetup-bucket-allocator-block-count=1"
    "memorysetup-main-allocator-block-size=16777216"
    "memorysetup-thread-allocator-block-size=16777216"
    "memorysetup-gfx-main-allocator-block-size=16777216"
    "memorysetup-gfx-thread-allocator-block-size=16777216"
    "memorysetup-cache-allocator-block-size=4194304"
    "memorysetup-typetree-allocator-block-size=2097152"
    "memorysetup-profiler-bucket-allocator-granularity=16"
    "memorysetup-profiler-bucket-allocator-bucket-count=8"
    "memorysetup-profiler-bucket-allocator-block-size=4194304"
    "memorysetup-profiler-bucket-allocator-block-count=1"
    "memorysetup-profiler-allocator-block-size=16777216"
    "memorysetup-profiler-editor-allocator-block-size=1048576"
    "memorysetup-temp-allocator-size-main=4194304"
    "memorysetup-job-temp-allocator-block-size=2097152"
    "memorysetup-job-temp-allocator-block-size-background=1048576"
    "memorysetup-job-temp-allocator-reduction-small-platforms=262144"
    "memorysetup-temp-allocator-size-background-worker=32768"
    "memorysetup-temp-allocator-size-job-worker=262144"
    "memorysetup-temp-allocator-size-preload-manager=262144"
    "memorysetup-temp-allocator-size-nav-mesh-worker=65536"
    "memorysetup-temp-allocator-size-audio-worker=65536"
    "memorysetup-temp-allocator-size-cloud-worker=32768"
    "memorysetup-temp-allocator-size-gfx=262144"
-> applicationDidFinishLaunching()
[libil2cpp] ERROR: Could not open /var/containers/Bundle/Application/F1855079-1CF0-4742-9C7A-93EFF3D3DC61/Runner.app/Frameworks/UnityFramework.framework/Data/Managed/Metadata/global-metadata.dat
   IL2CPP initialization failed
timbotimbo commented 1 year ago

It is looking for a Data folder in Unityframework.

Can you try selecting the Data folder in Xcode Unity-iPhone and ticking UnityFramework in Target Membership?

dnkoulouris commented 1 year ago

I solved it temporarily by switching the Build Target from iOS to macOS and then back to iOS in Unity Player Settings. For a strange reason it needs to be performed each time. It is also mentioned somewhere else.