diff --git a/src/DebugUtils/UnityDebugService/UnityDebugService.cs b/src/DebugUtils/UnityDebugService/UnityDebugService.cs index c5ad121..3aed828 100644 --- a/src/DebugUtils/UnityDebugService/UnityDebugService.cs +++ b/src/DebugUtils/UnityDebugService/UnityDebugService.cs @@ -1,30 +1,15 @@ using DCFApixels.DragonECS.Unity.Internal; using System; -using System.Reflection; using Unity.Profiling; -using UnityEditor; using UnityEngine; -#region [InitializeOnLoad] -#if UNITY_EDITOR -namespace DCFApixels.DragonECS -{ - using UnityEditor; - [InitializeOnLoad] - public partial class UnityDebugService { } -} -#endif -#endregion namespace DCFApixels.DragonECS { // Методы юнитевского Debug и ProfilerMarker потоко безопасны public partial class UnityDebugService : DebugService { private ProfilerMarker[] _profilerMarkers = new ProfilerMarker[64]; - static UnityDebugService() - { - Activate(); - } + public static void Activate() { if (Instance.GetType() == typeof(UnityDebugService)) { return; } diff --git a/src/Internal/Editor/UnityEditorUtility.cs b/src/Internal/Editor/UnityEditorUtility.cs index 09d0e0f..3abe0ff 100644 --- a/src/Internal/Editor/UnityEditorUtility.cs +++ b/src/Internal/Editor/UnityEditorUtility.cs @@ -109,8 +109,7 @@ namespace DCFApixels.DragonECS.Unity.Editors static UnityEditorUtility() { const int PREWARMUP_LIST_SIZE = 64; - EcsWorld.ResetStaticState(); - UnityDebugService.Activate(); + OnLoad(); _integrationAssembly = typeof(UnityEditorUtility).Assembly; @@ -212,7 +211,10 @@ namespace DCFApixels.DragonECS.Unity.Editors private static void OnLoad() { EcsWorld.ResetStaticState(); - UnityDebugService.Activate(); + if (DebugService.IsNullOrDefault) + { + UnityDebugService.Activate(); + } } internal static readonly Assembly _integrationAssembly;