mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 01:54:35 +08:00
rework UnityDebugService initialization
This commit is contained in:
parent
9bae371c25
commit
1620484297
@ -1,30 +1,15 @@
|
|||||||
using DCFApixels.DragonECS.Unity.Internal;
|
using DCFApixels.DragonECS.Unity.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
|
||||||
using Unity.Profiling;
|
using Unity.Profiling;
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
#region [InitializeOnLoad]
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
namespace DCFApixels.DragonECS
|
|
||||||
{
|
|
||||||
using UnityEditor;
|
|
||||||
[InitializeOnLoad]
|
|
||||||
public partial class UnityDebugService { }
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endregion
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
// Методы юнитевского Debug и ProfilerMarker потоко безопасны
|
// Методы юнитевского Debug и ProfilerMarker потоко безопасны
|
||||||
public partial class UnityDebugService : DebugService
|
public partial class UnityDebugService : DebugService
|
||||||
{
|
{
|
||||||
private ProfilerMarker[] _profilerMarkers = new ProfilerMarker[64];
|
private ProfilerMarker[] _profilerMarkers = new ProfilerMarker[64];
|
||||||
static UnityDebugService()
|
|
||||||
{
|
|
||||||
Activate();
|
|
||||||
}
|
|
||||||
public static void Activate()
|
public static void Activate()
|
||||||
{
|
{
|
||||||
if (Instance.GetType() == typeof(UnityDebugService)) { return; }
|
if (Instance.GetType() == typeof(UnityDebugService)) { return; }
|
||||||
|
@ -109,8 +109,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
static UnityEditorUtility()
|
static UnityEditorUtility()
|
||||||
{
|
{
|
||||||
const int PREWARMUP_LIST_SIZE = 64;
|
const int PREWARMUP_LIST_SIZE = 64;
|
||||||
EcsWorld.ResetStaticState();
|
OnLoad();
|
||||||
UnityDebugService.Activate();
|
|
||||||
|
|
||||||
_integrationAssembly = typeof(UnityEditorUtility).Assembly;
|
_integrationAssembly = typeof(UnityEditorUtility).Assembly;
|
||||||
|
|
||||||
@ -212,8 +211,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
private static void OnLoad()
|
private static void OnLoad()
|
||||||
{
|
{
|
||||||
EcsWorld.ResetStaticState();
|
EcsWorld.ResetStaticState();
|
||||||
|
if (DebugService.IsNullOrDefault)
|
||||||
|
{
|
||||||
UnityDebugService.Activate();
|
UnityDebugService.Activate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static readonly Assembly _integrationAssembly;
|
internal static readonly Assembly _integrationAssembly;
|
||||||
internal static readonly Type[] _serializableTypes;
|
internal static readonly Type[] _serializableTypes;
|
||||||
|
Loading…
Reference in New Issue
Block a user