Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

XCode cannot find 'ReferenceImageLibrary' on ARKit

Discussion in 'Handheld AR' started by SushiRoll53, Apr 2, 2020.

  1. SushiRoll53

    SushiRoll53

    Joined:
    Mar 30, 2020
    Posts:
    6
    Hello,

    I am working on developing an app on IOS with Unity. I use AR Foundation on Unity and ARKit on IOS, my issue is when I try to use the image targeting, specifically the "ReferenceImageLibrary" which XCode says that it cannot find, even though I double checked and it is there. I get the following error on XCode:

    [General] No resource group with name "ReferenceImageLibrary_CF9AB49B-B0D2-4B4E-92A0-743F79544309"
    found
    InvalidOperationException: Failed to set requested image library 'ReferenceImageLibrary' on
    ARKit - there is no matching resource group, or the resource group does not contain any
    reference images.


    Here is how the reference library looks on XCode


    Things I have tried:
    - Make the path "Absolute Path" for the ImageLibrary
    - Using only UnityFramework as my only target membership
    - Using both as my target membership

    Versions currently using:
    - Xcode 11.3.1
    - Unity 2019.3.5f1
    - AR Foundation 2.1.4
    - ARKit 2.1.1

    Let me know if more detail is required. Thank you!
     
  2. todds_unity

    todds_unity

    Unity Technologies

    Joined:
    Aug 1, 2018
    Posts:
    150
    Please try updating to either

    (1)
    - ARFoundation 2.2.0-preview.6
    - ARKit 2.2.0-preview.6

    or

    (2)
    - ARFoundation 3.0.1
    - ARKit 3.0.1
     
  3. SushiRoll53

    SushiRoll53

    Joined:
    Mar 30, 2020
    Posts:
    6
    Ok I just tried
    - ARFoundation 3.0.1
    - ARKit 3.0.1
    and got the same error

    On my version of Unity I do not see these version:
    - ARFoundation 2.2.0-preview.6
    - ARKit 2.2.0-preview.6
     
  4. todds_unity

    todds_unity

    Unity Technologies

    Joined:
    Aug 1, 2018
    Posts:
    150
    You have to enable "Show preview packages" in the "Advanced" drop-down menu in the Package Manager.
     
  5. SushiRoll53

    SushiRoll53

    Joined:
    Mar 30, 2020
    Posts:
    6
    I found & install them, but we still facing the same issue even with:
    - ARFoundation 2.2.0-preview.6
    - ARKit 2.2.0-preview.6

    Here is more details on what we get when we run the app, for now it is just a simple cube that loads when it sees the Unity logo. Also, I attached the code I am currently using. One more thing, a new folder was create when I build from this version, a folder called `ARReferenceObjects.xcassets` but it is empty. Could that affect?

    Initializing Metal device caps: Apple A12 GPU

    Initialize engine version: 2019.3.5f1 (d691e07d38ef)

    2020-04-01 23:23:15.075593-0600 Runner[15136:5360558] Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x121804190>.

    UnloadTime: 3.631375 ms

    [Subsystems] Loading plugin UnityARKit for subsystem ARKit-Input...

    [Subsystems] UnityARKit successfully registered Provider for ARKit-Input

    2020-04-01 23:23:17.109686-0600 Runner[15136:5360558] [General] No resource group with name "ReferenceImageLibrary_E00EF92C-1199-3B49-9644-14CE2F93FAB1" 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+Provider.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.SubsystemLifecycleManager`2[TSubsystem,TSubsystemDescriptor].OnEnable () [0x00000] in <00000000000000000000000000000000>:0


    (Filename: currently not available on il2cpp Line: -1)
     
  6. SushiRoll53

    SushiRoll53

    Joined:
    Mar 30, 2020
    Posts:
    6
    Here I also attached the script that I am using

    Code (CSharp):
    1. using System;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5. //import the libraries below
    6. using UnityEngine.XR.ARSubsystems;
    7. using UnityEngine.XR.ARFoundation;
    8. public class TrackedImage : MonoBehaviour
    9. {
    10.     //create the “trackable” manager to detect 2D images
    11.     ARTrackedImageManager m_TrackedImageManager;
    12.     //call Awake method to initialize tracked image manager
    13.     void Awake()
    14.     {
    15.         //initialized tracked image manager
    16.         m_TrackedImageManager = GetComponent<ARTrackedImageManager>();
    17.     }
    18.     //when the tracked image manager is enabled add binding to the tracked
    19.     //image changed event handler by calling a method to iterate through
    20.    //image reference’s changes
    21.     void OnEnable()
    22.     {
    23.         m_TrackedImageManager.trackedImagesChanged += OnTrackedImagesChanged;
    24.     }
    25.    //when the tracked image manager is disabled remove binding to the
    26.    //tracked image changed event handler by calling a method to iterate
    27.    //through image reference’s changes
    28.     void OnDisable()
    29.     {
    30.         m_TrackedImageManager.trackedImagesChanged -= OnTrackedImagesChanged;
    31.     }
    32.     //method to iterate tracked image changed event handler arguments
    33.     void OnTrackedImagesChanged(ARTrackedImagesChangedEventArgs eventArgs)
    34.     {
    35.         // for each tracked image that has been added
    36.         foreach (var trackedImage in eventArgs.added)
    37.         {
    38.             // Give the initial image a reasonable default scale
    39.            trackedImage.transform.localScale = new Vector3(1f, 1f, 1f);
    40.         }
    41.        
    42.         // for each tracked image that has been updated
    43.         foreach (var trackedImage in eventArgs.updated)
    44.            //throw tracked image to check tracking state
    45.             UpdateGameObject(trackedImage);
    46.         // for each tracked image that has been removed
    47.         foreach (var trackedImage in eventArgs.removed)
    48.         {
    49.             // destroy the AR object associated with the tracked image
    50.             Destroy(trackedImage.gameObject);
    51.         }
    52.     }
    53.     // method to update image tracked game object visibility
    54.     void UpdateGameObject(ARTrackedImage trackedImage)
    55.     {
    56.         Debug.Log("Tracking State: " + trackedImage.trackingState);
    57.         //if tracked image tracking state is comparable to tracking
    58.         if (trackedImage.trackingState == TrackingState.Tracking)
    59.         {
    60.             //set the image tracked ar object to active
    61.             trackedImage.gameObject.SetActive(true);
    62.         }
    63.         else //if tracked image tracking state is limited or none
    64.         {
    65.             //deactivate the image tracked ar object
    66.             trackedImage.gameObject.SetActive(false);
    67.         }
    68.     }
    69. }
     
unityunity