diff --git a/ECS/EnginesRootEngines.cs b/ECS/EnginesRootEngines.cs index fb47ffe..a74e26c 100644 --- a/ECS/EnginesRootEngines.cs +++ b/ECS/EnginesRootEngines.cs @@ -56,9 +56,6 @@ namespace Svelto.ECS _implementedInterfaceTypes = new Dictionary(); #endif #if ENGINE_PROFILER_ENABLED && UNITY_EDITOR - _addEntityViewToEngine = AddEntityViewToEngine; - _removeEntityViewFromEngine = RemoveEntityViewFromEngine; - UnityEngine.GameObject debugEngineObject = new UnityEngine.GameObject("Engine Debugger"); debugEngineObject.gameObject.AddComponent(); #endif @@ -206,11 +203,7 @@ namespace Svelto.ECS readonly Dictionary _implementedInterfaceTypes; #endif - -#if ENGINE_PROFILER_ENABLED && UNITY_EDITOR - static Action _addEntityViewToEngine; - static Action _removeEntityViewFromEngine; -#endif + readonly EngineEntityViewDB _engineEntityViewDB; class DoubleBufferedEntityViews where T : class, IDictionary, new() diff --git a/ECS/EnginesRootEntities.cs b/ECS/EnginesRootEntities.cs index 7d258ab..923c2bb 100644 --- a/ECS/EnginesRootEntities.cs +++ b/ECS/EnginesRootEntities.cs @@ -222,7 +222,7 @@ namespace Svelto.ECS for (int j = 0; j < count; j++) { #if ENGINE_PROFILER_ENABLED && UNITY_EDITOR - EngineProfiler.MonitorRemoveDuration(_removeEntityViewFromEngine, fastList[j], entityView); + EngineProfiler.MonitorRemoveDuration(fastList[j], entityView); #else fastList[j].Remove(entityView); #endif @@ -230,18 +230,6 @@ namespace Svelto.ECS } } -#if ENGINE_PROFILER_ENABLED && UNITY_EDITOR - static void AddEntityViewToEngine(IHandleEntityViewEngine engine, IEntityView entityView) - { - engine.Add(entityView); - } - - static void RemoveEntityViewFromEngine(IHandleEntityViewEngine engine, IEntityView entityView) - { - engine.Remove(entityView); - } -#endif - class GenericEntityFactory : IEntityFactory { DataStructures.WeakReference _weakEngine; diff --git a/ECS/EnginesRootSubmission.cs b/ECS/EnginesRootSubmission.cs index c0c7641..b51f3f2 100644 --- a/ECS/EnginesRootSubmission.cs +++ b/ECS/EnginesRootSubmission.cs @@ -148,7 +148,7 @@ namespace Svelto.ECS for (int j = 0; j < count; j++) { #if ENGINE_PROFILER_ENABLED && UNITY_EDITOR - EngineProfiler.MonitorAddDuration(_addEntityViewToEngine, fastList[j], entityView); + EngineProfiler.MonitorAddDuration(fastList[j], entityView); #else fastList[j].Add(entityView); #endif diff --git a/ECS/Profiler/EngineProfiler.cs b/ECS/Profiler/EngineProfiler.cs index 5f0765d..3e10786 100644 --- a/ECS/Profiler/EngineProfiler.cs +++ b/ECS/Profiler/EngineProfiler.cs @@ -12,26 +12,25 @@ namespace Svelto.ECS.Profiler { static readonly Stopwatch _stopwatch = new Stopwatch(); - public static void MonitorAddDuration(Action addingFunc, IHandleEntityViewEngine engine, IEntityView entityView) + public static void MonitorAddDuration(IHandleEntityViewEngine engine, IEntityView entityView) { EngineInfo info; if (engineInfos.TryGetValue(engine.GetType(), out info)) { _stopwatch.Start(); - addingFunc(engine, entityView); + engine.Add(entityView); _stopwatch.Reset(); info.AddAddDuration(_stopwatch.Elapsed.TotalMilliseconds); } } - public static void MonitorRemoveDuration(Action removeFunc, IHandleEntityViewEngine engine, IEntityView entityView) + public static void MonitorRemoveDuration(IHandleEntityViewEngine engine, IEntityView entityView) { EngineInfo info; if (engineInfos.TryGetValue(engine.GetType(), out info)) { _stopwatch.Start(); - removeFunc(engine, entityView); engine.Remove(entityView); _stopwatch.Reset();