Beispiel #1
0
        private static Hash128 ProduceArtifact(GUID guid, Type importerType, ImportMode mode, out OnDemandState state)
        {
            state = OnDemandState.Unavailable;
            switch (mode)
            {
                #if UNITY_2020_2_OR_NEWER
            case ImportMode.Asynchronous:
                return(AssetDatabaseExperimental.ProduceArtifactAsync(new ArtifactKey(guid, importerType)).value);

            case ImportMode.Synchronous:
                return(AssetDatabaseExperimental.ProduceArtifact(new ArtifactKey(guid, importerType)).value);

            case ImportMode.NoImport:
                var akey = new ArtifactKey(guid, importerType);
                var id   = AssetDatabaseExperimental.LookupArtifact(akey).value;
                if (!id.isValid)
                {
                    state = AssetDatabaseExperimental.GetOnDemandArtifactProgress(akey).state;
                }
                return(id);
                #else
            case ImportMode.Asynchronous:
                return(AssetDatabaseExperimental.GetArtifactHash(guid.ToString(), importerType, AssetDatabaseExperimental.ImportSyncMode.Queue));

            case ImportMode.Synchronous:
                return(AssetDatabaseExperimental.GetArtifactHash(guid.ToString(), importerType));

            case ImportMode.NoImport:
                return(AssetDatabaseExperimental.GetArtifactHash(guid.ToString(), importerType, AssetDatabaseExperimental.ImportSyncMode.Poll));
                #endif
            }

            return(default);
        private static Hash128 ProduceArtifact(GUID guid, Type importerType, ImportMode mode, out OnDemandState state)
        {
            var akey = new ArtifactKey(guid, importerType);

            state = AssetDatabaseExperimental.GetOnDemandArtifactProgress(akey).state;

            if (state == OnDemandState.Failed)
            {
                return(default);