static void AddReferenceImagesSetToAssetCatalog(ARReferenceImagesSet aris, string pathToBuiltProject, PBXProject project) { List <ARReferenceImage> processedImages = new List <ARReferenceImage> (); ARResourceGroupContents groupContents = new ARResourceGroupContents(); groupContents.info = new ARResourceGroupInfo(); groupContents.info.author = "xcode"; groupContents.info.version = 1; string folderToCreate = "Unity-iPhone/Images.xcassets/" + aris.resourceGroupName + ".arresourcegroup"; string folderFullPath = Path.Combine(pathToBuiltProject, folderToCreate); Directory.CreateDirectory(folderFullPath); project.AddFolderReference(folderFullPath, folderToCreate); foreach (ARReferenceImage arri in aris.referenceImages) { if (!processedImages.Contains(arri)) { processedImages.Add(arri); //get rid of dupes AddReferenceImageToResourceGroup(arri, folderFullPath, folderToCreate, project); } } groupContents.resources = new ARResourceGroupResource[processedImages.Count]; int index = 0; foreach (ARReferenceImage arri in processedImages) { groupContents.resources [index] = new ARResourceGroupResource(); groupContents.resources [index].filename = arri.imageName + ".arreferenceimage"; index++; } string contentsJsonPath = Path.Combine(folderFullPath, "Contents.json"); File.WriteAllText(contentsJsonPath, JsonUtility.ToJson(groupContents, true)); project.AddFile(contentsJsonPath, Path.Combine(folderToCreate, "Contents.json")); }
/// <summary> /// Inits the image anchors tracking. /// </summary> /// <param name="imageManager">Anchor image manager.</param> public override void InitImageAnchorsTracking(AnchorImageManager imageManager) { arImageDatabase = Resources.Load <ARReferenceImagesSet>("ArKitImageDatabase"); Debug.Log("arImageDatabase initialized: " + (arImageDatabase != null ? arImageDatabase.resourceGroupName : "-")); }