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.15k stars 524 forks source link

Failed to initialize subsystem ARKit-Meshing [error: 1] #434

Closed what2003 closed 3 years ago

what2003 commented 3 years ago

Tried ARfundation ImageTracking scene in flutter, got"Failed to initialize subsystem ARKit-Meshing [error: 1]". Built by Unity is working fine on my Iphone. Tried Demo which is 2 years old, works good except ImageTracking scene. Detail in https://github.com/juicycleff/flutter-unity-arkit-demo/issues/13#issue-950250180

Unity 2021.1.15f1 IOS flutter_unity_widget: ^4.2.1 $ flutter doctor -v [✓] Flutter (Channel dev, 2.3.0-12.1.pre, on Mac OS X 10.15.4 19E287 darwin-x64, locale zh-Hans) • Flutter version 2.3.0-12.1.pre at /Users/jack/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f9c825981c (9 weeks ago), 2021-05-18 14:07:52 -0700 • Engine revision 26e217e6c3 • Dart version 2.14.0 (build 2.14.0-edge.a527411e5100a0a4f48c4009087a1b988aa784af) • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at /Users/jack/Library/Android/sdk • Platform android-30, build-tools 29.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.1, Build version 12A7403 • CocoaPods version 1.10.1

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.6) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 45.1.1 • Dart plugin version 192.7761 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.58.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.24.0

[✓] Connected device (2 available) • 吴杰的 iPhone7 (mobile) • eed6e3b2d815420621d441672707634130e89e16 • ios • iOS 13.5.1 • Chrome (web) • chrome • web-javascript • Google Chrome 83.0.4103.61 ! Error: 吴杰的 iPhone7 is busy: Copying cache files from device. Xcode will continue when 吴杰的 iPhone7 is finished. (code -10)

• No issues found!

$ flutter run
Launching lib/main.dart on 吴杰的 iPhone7 in debug mode... Automatically signing iOS for device deployment using specified development team in Xcode project: 65TSJ9E93J Running pod install... 1,768ms Running Xcode build...
└─Compiling, linking and signing... 9.6s Xcode build done. 34.1s iOS Observatory not discovered after 30 seconds. This is taking much longer than expected... Installing and launching... 72.5s Syncing files to device 吴杰的 iPhone7... 114ms

Flutter run key commands. r Hot reload. 🔥🔥🔥 R Hot restart. h List all available interactive commands. d Detach (terminate "flutter run" but leave application running). c Clear the screen q Quit (terminate the application on the device).

Running with unsound null safety For more information see https://dart.dev/null-safety/unsound-null-safety

An Observatory debugger and profiler on 吴杰的 iPhone7 is available at: http://127.0.0.1:58860/PFxqhe5EXTc=/ [VERBOSE-2:profiler_metrics_ios.mm(203)] Error retrieving thread information: (os/kern) invalid argument Activating Dart DevTools... 7.5s The Flutter DevTools debugger and profiler on 吴杰的 iPhone7 is available at: http://127.0.0.1:9101?uri=http%3A%2F%2F127.0.0.1%3A58860%2FPFxqhe5EXTc%3D%2F Built from '2021.1/china_unity/release' branch, Version '2021.1.15f1c1 (53017094f33d)', Build type 'Release', Scripting Backend 'il2cpp' MemoryManager: Using 'Default' Allocator. -> applicationDidFinishLaunching()

Setting UIViewControllerBasedStatusBarAppearance to NO is no longer supported. Apple actively discourages that, and all application-wide methods of changing status bar appearance are deprecated

-> applicationWillEnterForeground() -> applicationDidBecomeActive() [Subsystems] Discovering subsystems at path /var/containers/Bundle/Application/2EBA3131-A1EF-4E84-86F2-2EF077F4CC03/Runner.app/Frameworks/UnityFramework.framework/Data/UnitySubsystems [Subsystems] No descriptors matched for examples in UnitySubsystems/UnityARKit/UnitySubsystemsManifest.json. [Subsystems] 1 'inputs' descriptors matched in UnitySubsystems/UnityARKit/UnitySubsystemsManifest.json [Subsystems] No descriptors matched for displays in UnitySubsystems/UnityARKit/UnitySubsystemsManifest.json. [Subsystems] 1 'meshings' descriptors matched in UnitySubsystems/UnityARKit/UnitySubsystemsManifest.json GfxDevice: creating device client; threaded=1; jobified=0 Initializing Metal device caps: Apple A10 GPU Initialize engine version: 2021.1.15f1c1 (53017094f33d) flutter: flutter: flutter unity controller setup complete flutter: XRGeneral Settings awakening... UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:Log(LogType, Object) UnityEngine.Debug:Log(Object) UnityEngine.XR.Management.XRGeneralSettings:Awake()

// 2D joint skeleton
enum JointIndices
{
    Invalid = -1,
    Head = 0, // parent: Neck1 [1]
    Neck1 = 1, // parent: Root [16]
    RightShoulder1 = 2, // parent: Neck1 [1]
    RightForearm = 3, // parent: RightShoulder1 [2]
    RightHand = 4, // parent: RightForearm [3]
    LeftShoulder1 = 5, // parent: Neck1 [1]
    LeftForearm = 6, // parent: LeftShoulder1 [5]
    LeftHand = 7, // parent: LeftForearm [6]
    RightUpLeg = 8, // parent: Root [16]
    RightLeg = 9, // parent: RightUpLeg [8]
    RightFoot = 10, // parent: RightLeg [9]
    LeftUpLeg = 11, // parent: Root [16]
    LeftLeg = 12, // parent: LeftUpLeg [11]
    LeftFoot = 13, // parent: LeftLeg [12]
    RightEye = 14, // parent: Head [0]
    LeftEye = 15, // parent: Head [0]
    Root = 16, // parent: <none> [-1]
}

// 3D joint skeleton
enum JointIndices
{
    Invalid = -1,
    Root = 0, // parent: <none> [-1]
    Hips = 1, // parent: Root [0]
    LeftUpLeg = 2, // parent: Hips [1]
    LeftLeg = 3, // parent: LeftUpLeg [2]
    LeftFoot = 4, // parent: LeftLeg [3]
    LeftToes = 5, // parent: LeftFoot [4]
    LeftToesEnd = 6, // parent: LeftToes [5]
    RightUpLeg = 7, // parent: Hips [1]
    RightLeg = 8, // parent: RightUpLeg [7]
    RightFoot = 9, // parent: RightLeg [8]
    RightToes = 10, // parent: RightFoot [9]
    RightToesEnd = 11, // parent: RightToes [10]
    Spine1 = 12, // parent: Hips [1]
    Spine2 = 13, // parent: Spine1 [12]
    Spine3 = 14, // parent: Spine2 [13]
    Spine4 = 15, // parent: Spine3 [14]
    Spine5 = 16, // parent: Spine4 [15]
    Spine6 = 17, // parent: Spine5 [16]
    Spine7 = 18, // parent: Spine6 [17]
    LeftShoulder1 = 19, // parent: Spine7 [18]
    LeftArm = 20, // parent: LeftShoulder1 [19]
    LeftForearm = 21, // parent: LeftArm [20]
    LeftHand = 22, // parent: LeftForearm [21]
    LeftHandIndexStart = 23, // parent: LeftHand [22]
    LeftHandIndex1 = 24, // parent: LeftHandIndexStart [23]
    LeftHandIndex2 = 25, // parent: LeftHandIndex1 [24]
    LeftHandIndex3 = 26, // parent: LeftHandIndex2 [25]
    LeftHandIndexEnd = 27, // parent: LeftHandIndex3 [26]
    LeftHandMidStart = 28, // parent: LeftHand [22]
    LeftHandMid1 = 29, // parent: LeftHandMidStart [28]
    LeftHandMid2 = 30, // parent: LeftHandMid1 [29]
    LeftHandMid3 = 31, // parent: LeftHandMid2 [30]
    LeftHandMidEnd = 32, // parent: LeftHandMid3 [31]
    LeftHandPinkyStart = 33, // parent: LeftHand [22]
    LeftHandPinky1 = 34, // parent: LeftHandPinkyStart [33]
    LeftHandPinky2 = 35, // parent: LeftHandPinky1 [34]
    LeftHandPinky3 = 36, // parent: LeftHandPinky2 [35]
    LeftHandPinkyEnd = 37, // parent: LeftHandPinky3 [36]
    LeftHandRingStart = 38, // parent: LeftHand [22]
    LeftHandRing1 = 39, // parent: LeftHandRingStart [38]
    LeftHandRing2 = 40, // parent: LeftHandRing1 [39]
    LeftHandRing3 = 41, // parent: LeftHandRing2 [40]
    LeftHandRingEnd = 42, // parent: LeftHandRing3 [41]
    LeftHandThumbStart = 43, // parent: LeftHand [22]
    LeftHandThumb1 = 44, // parent: LeftHandThumbStart [43]
    LeftHandThumb2 = 45, // parent: LeftHandThumb1 [44]
    LeftHandThumbEnd = 46, // parent: LeftHandThumb2 [45]
    Neck1 = 47, // parent: Spine7 [18]
    Neck2 = 48, // parent: Neck1 [47]
    Neck3 = 49, // parent: Neck2 [48]
    Neck4 = 50, // parent: Neck3 [49]
    Head = 51, // parent: Neck4 [50]
    Jaw = 52, // parent: Head [51]
    Chin = 53, // parent: Jaw [52]
    LeftEye = 54, // parent: Head [51]
    LeftEyeLowerLid = 55, // parent: LeftEye [54]
    LeftEyeUpperLid = 56, // parent: LeftEye [54]
    LeftEyeball = 57, // parent: LeftEye [54]
    Nose = 58, // parent: Head [51]
    RightEye = 59, // parent: Head [51]
    RightEyeLowerLid = 60, // parent: RightEye [59]
    RightEyeUpperLid = 61, // parent: RightEye [59]
    RightEyeball = 62, // parent: RightEye [59]
    RightShoulder1 = 63, // parent: Spine7 [18]
    RightArm = 64, // parent: RightShoulder1 [63]
    RightForearm = 65, // parent: RightArm [64]
    RightHand = 66, // parent: RightForearm [65]
    RightHandIndexStart = 67, // parent: RightHand [66]
    RightHandIndex1 = 68, // parent: RightHandIndexStart [67]
    RightHandIndex2 = 69, // parent: RightHandIndex1 [68]
    RightHandIndex3 = 70, // parent: RightHandIndex2 [69]
    RightHandIndexEnd = 71, // parent: RightHandIndex3 [70]
    RightHandMidStart = 72, // parent: RightHand [66]
    RightHandMid1 = 73, // parent: RightHandMidStart [72]
    RightHandMid2 = 74, // parent: RightHandMid1 [73]
    RightHandMid3 = 75, // parent: RightHandMid2 [74]
    RightHandMidEnd = 76, // parent: RightHandMid3 [75]
    RightHandPinkyStart = 77, // parent: RightHand [66]
    RightHandPinky1 = 78, // parent: RightHandPinkyStart [77]
    RightHandPinky2 = 79, // parent: RightHandPinky1 [78]
    RightHandPinky3 = 80, // parent: RightHandPinky2 [79]
    RightHandPinkyEnd = 81, // parent: RightHandPinky3 [80]
    RightHandRingStart = 82, // parent: RightHand [66]
    RightHandRing1 = 83, // parent: RightHandRingStart [82]
    RightHandRing2 = 84, // parent: RightHandRing1 [83]
    RightHandRing3 = 85, // parent: RightHandRing2 [84]
    RightHandRingEnd = 86, // parent: RightHandRing3 [85]
    RightHandThumbStart = 87, // parent: RightHand [66]
    RightHandThumb1 = 88, // parent: RightHandThumbStart [87]
    RightHandThumb2 = 89, // parent: RightHandThumb1 [88]
    RightHandThumbEnd = 90, // parent: RightHandThumb2 [89]
}

[Subsystems] Loading plugin UnityARKit for subsystem ARKit-Input... [Subsystems] UnityARKit successfully registered Provider for ARKit-Input [Subsystems] Loading plugin UnityARKit for subsystem ARKit-Meshing... [Subsystems] Failed to initialize subsystem ARKit-Meshing [error: 1] UnloadTime: 4.576666 ms [General] No resource group with name "ReferenceImageLibrary_0D75963B-ACC4-974A-9BC3-CE6A5DE9A3D7" found InvalidOperationException: Failed to resolve image library 'ReferenceImageLibrary'. There is no matching resource group, or the resource group does not contain any reference images. at UnityEngine.XR.ARKit.ARKitImageDatabase..ctor (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary serializedLibrary) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.XR.ARKit.ARKitImageTrackingSubsystem+ARKitProvider.CreateRuntimeLibrary (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary serializedLibrary) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.XR.ARSubsystems.XRImageTrackingSubsystem.CreateRuntimeLibrary (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary serializedLibrary) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.XR.ARFoundation.ARTrackedImageManager.OnBeforeStart () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.XR.ARFoundation.SubsystemLifecycleManager3[TSubsystem,TSubsystemDescriptor,TProvider].OnEnable () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.XR.ARFoundation.ARTrackableManager5[TSubsystem,TSubsystemDescriptor,TProvider,TSessionRelativeData,TTrackable].OnEnable () [0x00000] in <00000000000000000000000000000000>:0

UnityARKit: Updating ARSession configuration with <ARWorldTrackingConfiguration: 0x281721740 worldAlignment=Gravity lightEstimation=Disabled frameSemantics=None videoFormat=<ARVideoFormat: 0x28014c960 imageResolution=(1920, 1440) framesPerSecond=(60)> autoFocus=Enabled environmentTexturing=None wantsHDREnvironmentTextures=Enabled planeDetection=None collaboration=Disabled userFaceTracking=Disabled sceneReconstruction=None>

Application finished.

what2003 commented 3 years ago

Have built plane finder scene in Unity2021.1.15f1 ArFoundtion4.15, works fine in flutter built on Iphone. But it also shows error message"[Subsystems] Failed to initialize subsystem ARKit-Meshing [error: 1]", don't know why but apparently it doesn't matter. "[General] No resource group with name "ReferenceImageLibrary_0D75963B-ACC4-974A-9BC3-CE6A5DE9A3D7" found InvalidOperationException: Failed to resolve image library 'ReferenceImageLibrary'. There is no matching resource group, or the resource group does not contain any reference images." is the real problem. I'm learning to create MutableRuntimeReferenceImageLibrary and add images in runtime, maybe that can work.

what2003 commented 3 years ago

The conclusion is creating ReferenceImageLibrary in Editor would fail! In script so far works for me.

trackImageManager = gameObject.AddComponent(); trackImageManager.referenceLibrary = trackImageManager.CreateRuntimeLibrary(); trackImageManager.maxNumberOfMovingImages = 4; trackImageManager.enabled = true; mutableRuntimeReferenceImageLibrary = trackImageManager.referenceLibrary as MutableRuntimeReferenceImageLibrary;