1
\$\begingroup\$

I'm new to Unity and I have no idea what this error means, I'm following a tutorial on YouTube which had no error of the sort.

Any idea how can I fix this?

BuildFailedException: ARCore Image Library Generation: Reference library at 'Assets/ReferenceImageLibrary.asset' is missing a texture at index 1.
UnityEditor.XR.ARCore.ARCorePreprocessBuild.BuildImageTrackingAssets () (at Library/PackageCache/[email protected]/Editor/ARCoreBuildProcessor.cs:286)
UnityEditor.XR.ARCore.ARCorePreprocessBuild.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at Library/PackageCache/[email protected]/Editor/ARCoreBuildProcessor.cs:33)
UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass15_0.<OnBuildPreProcess>b__1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

The code is the following:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
using UnityEngine.XR.ARFoundation;


public class RecognitionScript : MonoBehaviour
{
    private ARTrackedImageManager _arTrackedImageManager;

    private void Awake()
    {
        _arTrackedImageManager = FindObjectOfType<ARTrackedImageManager>();

    }

    public void OnEnable()
    {

        _arTrackedImageManager.trackedImagesChanged += OnImageChanged;
    }

    public void OnDisable()
    {
        _arTrackedImageManager.trackedImagesChanged -= OnImageChanged;
    }

    public void OnImageChanged(ARTrackedImagesChangedEventArgs args)
    {
        foreach (var trackedImage in args.added)
        {
            UnityEngine.Debug.Log(trackedImage.name);
        }
    }
}
\$\endgroup\$
2
  • \$\begingroup\$ Please provide more information, such as the script that is hitting the error along with the video that you are following. \$\endgroup\$ Jun 11, 2020 at 15:26
  • \$\begingroup\$ Woops, thought I did. \$\endgroup\$
    – OmarAI
    Jun 11, 2020 at 16:10

1 Answer 1

2
\$\begingroup\$

The error message references the file Assets/ReferenceImageLibrary.asset. This is the part he's going over at around 3:30 into the video.

In the Project panel in the Unity Editor, find the file at Assets/ReferenceImageLibrary. Select this file, and you should see something in the Inspector. You most likely forgot to select a texture for one of the entries in the library (if that's the case, the preview image will say "None (Texture 2D)". Just click the "Select" button and select a texture from your project.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .