public void OnPostprocessBuild(BuildReport report)
            {
                if (report.summary.platform != BuildTarget.iOS)
                {
                    return;
                }

                var buildOutputPath = report.summary.outputPath;

                // Read in the Xcode project
                var pbxProjectPath = PBXProject.GetPBXProjectPath(buildOutputPath);
                var pbxProject     = new PBXProject();

                pbxProject.ReadFromString(File.ReadAllText(pbxProjectPath));

                // Create a new asset catalog
                var assetCatalog = new XcodeAssetCatalog("ARReferenceObjects");

                // Create a resource group for each reference object set
                foreach (var resourceGroup in ResourceGroups(Warnings.All))
                {
                    assetCatalog.AddResourceGroup(resourceGroup);
                }

                // Write the asset catalog to disk
                assetCatalog.WriteAndAddToPBXProject(pbxProject, buildOutputPath);

                // Write out the updated Xcode project
                File.WriteAllText(pbxProjectPath, pbxProject.WriteToString());
            }
            public void OnPostprocessBuild(BuildReport report)
            {
#if UNITY_XR_ARKIT_LOADER_ENABLED
                if (report.summary.platform != BuildTarget.iOS)
                {
                    return;
                }

                var buildOutputPath = report.summary.outputPath;

                // Read in the PBXProject
                var project        = new PBXProject();
                var pbxProjectPath = PBXProject.GetPBXProjectPath(buildOutputPath);
                project.ReadFromString(File.ReadAllText(pbxProjectPath));

                // Create a new asset catalog
                var assetCatalog = new XcodeAssetCatalog("ARReferenceImages");

                // Generate resource groups and add each one to the asset catalog
                foreach (var resourceGroup in ResourceGroups())
                {
                    assetCatalog.AddResourceGroup(resourceGroup);
                }

                // Create the asset catalog on disk
                assetCatalog.WriteAndAddToPBXProject(project, buildOutputPath);

                // Write out the updated Xcode project file
                File.WriteAllText(pbxProjectPath, project.WriteToString());
#endif
            }
        public byte[] ToCar(Version minimumDeploymentTarget)
        {
            var catalog = new XcodeAssetCatalog(null);

            catalog.AddResourceGroup(this);
            return(catalog.ToCar(minimumDeploymentTarget));
        }
Beispiel #4
0
            public void OnPostprocessBuild(BuildReport report)
            {
#if UNITY_XR_ARKIT_LOADER_ENABLED
                if (report.summary.platform != BuildTarget.iOS)
                {
                    return;
                }

                var buildOutputPath = report.summary.outputPath;

                // Read in the PBXProject
                var project        = new PBXProject();
                var pbxProjectPath = PBXProject.GetPBXProjectPath(buildOutputPath);
                project.ReadFromString(File.ReadAllText(pbxProjectPath));

                // Create a new asset catalog
                var assetCatalog = new XcodeAssetCatalog("ARReferenceImages");

                // Generate resource groups and add each one to the asset catalog
                foreach (var(resourceGroup, library) in ResourceGroups())
                {
                    // Only add libraries where we don't already have the data
                    if (!library.dataStore.ContainsKey(ARKitPackageInfo.identifier))
                    {
                        assetCatalog.AddResourceGroup(resourceGroup);
                    }
                }

                // Don't create empty asset catalogs
                if (assetCatalog.count == 0)
                {
                    return;
                }

                // Create the asset catalog on disk
                assetCatalog.WriteAndAddToPBXProject(project, buildOutputPath);

                // Write out the updated Xcode project file
                File.WriteAllText(pbxProjectPath, project.WriteToString());
#endif
            }