public static void Enable() { if (AssetDatabaseAPI.IsAssetImportWorkerProcess()) { return; } s_Enabled = true; }
static void LoadCustomObjectIndexers() { var globalIndexersHash = RefreshCustomIndexers(); if (!AssetDatabaseAPI.IsAssetImportWorkerProcess()) { EditorApplication.delayCall += () => AssetDatabaseAPI.RegisterCustomDependency(nameof(CustomObjectIndexerAttribute), globalIndexersHash); } }
static AssetPostprocessorIndexer() { if (AssetDatabaseAPI.IsAssetImportWorkerProcess()) { return; } transactionManager = new TransactionManager(k_TransactionDatabasePath); transactionManager.Init(); EditorApplication.quitting += OnQuitting; AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload; AssemblyReloadEvents.afterAssemblyReload += OnAfterAssemblyReload; }
internal static bool IsMainProcess() { if (AssetDatabaseAPI.IsAssetImportWorkerProcess()) { return(false); } if (EditorUtility.isInSafeMode) { return(false); } if (MPE.ProcessService.level != MPE.ProcessLevel.Main) { return(false); } return(true); }
static void LoadCustomObjectIndexers() { Hash128 globalIndexersHash = default; foreach (var customIndexerMethodInfo in Utils.GetAllMethodsWithAttribute <CustomObjectIndexerAttribute>()) { var customIndexerAttribute = customIndexerMethodInfo.GetCustomAttribute <CustomObjectIndexerAttribute>(); var indexerType = customIndexerAttribute.type; if (indexerType == null) { continue; } if (!ValidateCustomIndexerMethodSignature(customIndexerMethodInfo)) { continue; } if (!(Delegate.CreateDelegate(typeof(CustomIndexerHandler), customIndexerMethodInfo) is CustomIndexerHandler customIndexerAction)) { continue; } if (!s_CustomObjectIndexers.TryGetValue(indexerType, out var indexerList)) { indexerList = new List <CustomIndexerHandler>(); s_CustomObjectIndexers.Add(indexerType, indexerList); } indexerList.Add(customIndexerAction); var customIndexerHash = ComputeCustomIndexerHash(customIndexerMethodInfo, customIndexerAttribute); HashUtilities.AppendHash(ref customIndexerHash, ref globalIndexersHash); } #if UNITY_2020_1_OR_NEWER if (!AssetDatabaseAPI.IsAssetImportWorkerProcess()) { EditorApplication.delayCall += () => AssetDatabaseAPI.RegisterCustomDependency(nameof(CustomObjectIndexerAttribute), globalIndexersHash); } #endif }