Hi all,
I’m having trouble implementing the method below to avoid relying on xcrun for exporting AR reference images. This is because I am developing on Windows and building an Xcode project to run on a Mac later. As I’m very new to the platform, I’d appreciate some advice on how to get this working in my project. Note that I am following the tutorial below:
Spawn an Object on AR Marker
protected void InitLibraryManager()
{
if (!libraryInitialized)
{
libraryInitialized = true;
if (imageManager.referenceLibrary == null)
{
imageManager.referenceLibrary = imageManager.CreateRuntimeLibrary();
if (imageManager.referenceLibrary == null)
{
Debug.LogError("AR: Unable to dynamically create ReferenceLibrary.")
return;
}
}
//The number of images can be 0 if we just created the Library above, or if
//this binary was built on Windows thus failing to copy the images correctly
//into the build for a referenceLibrary set in the editor. In either
//case, we'll dynamically add the image here...
if (imageManager.referenceLibrary.count == 0)
{
Debug.Log("AR: Detected no library images, adding our image dynamically as a workaround...");
if (imageManager.referenceLibrary is MutableRuntimeReferenceImageLibrary mutableLibrary)
{
Debug.Log("AR: Dynamically adding image.");
//imageToTrack must be read/write, RGB24.
mutableLibrary.ScheduleAddImageWithValidationJob(imageToTrack, "QRCode", 0.104775f);
}
else
{
Debug.LogError("AR: Workaround failed - ImageManager ReferenceLibrary cannot be dynamically added to.");
}
}
}
}
%
