Example #1
0
        private IndexArtifact[] ProduceArtifacts(IList <string> assetPaths)
        {
            var artifacts         = InitializeIndexArtifacts(assetPaths);
            var indexImporterType = SearchIndexEntryImporter.GetIndexImporterType(settings.type, settings.options.GetHashCode());

            #if UNITY_2020_2_OR_NEWER
            var artifactIds = AssetDatabaseExperimental.ProduceArtifactsAsync(artifacts.Select(a => new GUID(a.guid)).ToArray(), indexImporterType);
            for (int i = 0; i < artifactIds.Length; ++i)
            {
                artifacts[i].key = artifactIds[i].value;
            }
            #else
            for (int i = 0; i < artifacts.Length; ++i)
            {
                if (String.IsNullOrEmpty(artifacts[i].guid))
                {
                    continue;
                }
                artifacts[i].key = ProduceArtifact(artifacts[i].guid, indexImporterType, ImportMode.Asynchronous);
            }
            #endif

            return(artifacts);
        }