using JetBrains.RiderFlow.Core.Launchers; using JetBrains.RiderFlow.Core.ReEditor.Notifications; using JetBrains.RiderFlow.Core.Services.Caches.RecentFiles; using JetBrains.RiderFlow.Core.UI.SearchEverywhere; using UnityEditor; namespace JetBrains.RiderFlow.Since2020_2 { [InitializeOnLoad] public class DelayedEntryPoint { static DelayedEntryPoint() { SearchEverywhereWindow.Settings = SearchWindowSettings.instance; RecentFilesCacheController.Cache = RecentFilesCache.instance; ProgressManagerOwner.ProgressManager = new ProgressManager(); EditorApplication.delayCall += OnEnable; } protected static void OnEnable() { if (!IsPrimaryUnityProcess()) return; Launcher.Run(); } private static bool IsPrimaryUnityProcess() { if (AssetDatabase.IsAssetImportWorkerProcess()) return false; #if UNITY_2021_1_OR_NEWER if (UnityEditor.MPE.ProcessService.level == UnityEditor.MPE.ProcessLevel.Secondary) return false; #elif UNITY_2020_2_OR_NEWER if (UnityEditor.MPE.ProcessService.level == UnityEditor.MPE.ProcessLevel.Slave) return false; #elif UNITY_2020_1_OR_NEWER if (Unity.MPE.ProcessService.level == Unity.MPE.ProcessLevel.UMP_SLAVE) return false; #endif return true; } } }