From 7a8cbf9f0a7e51f5b932c4db07945a6e2b69c9bd Mon Sep 17 00:00:00 2001
From: Mikhail <99481254+DCFApixels@users.noreply.github.com>
Date: Mon, 23 Mar 2026 16:29:10 +0800
Subject: [PATCH] fix
---
src/Pools/EcsPoolBase.cs | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/Pools/EcsPoolBase.cs b/src/Pools/EcsPoolBase.cs
index 8aa01ef..6874a07 100644
--- a/src/Pools/EcsPoolBase.cs
+++ b/src/Pools/EcsPoolBase.cs
@@ -1,6 +1,12 @@
#if DISABLE_DEBUG
#undef DEBUG
#endif
+#if !DRAGONECS_DISABLE_POOLS_EVENTS
+#define DRAGONECS_ENABLE_POOLS_EVENTS
+#else
+#undef DRAGONECS_ENABLE_POOLS_EVENTS
+#endif
+
using DCFApixels.DragonECS.Core.Internal;
using DCFApixels.DragonECS.PoolsCore;
using System;
@@ -100,7 +106,7 @@ namespace DCFApixels.DragonECS.Core.Internal
#if DEBUG
throw new NullInstanceException();
#else
- return EcsWorld.GetWorld(0);
+ return EcsWorld.GetWorld(0);
#endif
}
}
@@ -291,14 +297,15 @@ namespace DCFApixels.DragonECS
/// Called after deleting an entity from the pool
void OnDel(int entityID);
}
-#if !DRAGONECS_DISABLE_POOLS_EVENTS
public static class PoolEventListExtensions
{
+ [Conditional("DRAGONECS_ENABLE_POOLS_EVENTS")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeOnAdd(this List self, int entityID)
{
for (int i = 0; i < self.Count; i++) { self[i].OnAdd(entityID); }
}
+ [Conditional("DRAGONECS_ENABLE_POOLS_EVENTS")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeOnAddAndGet(this List self, int entityID)
{
@@ -308,11 +315,13 @@ namespace DCFApixels.DragonECS
self[i].OnGet(entityID);
}
}
+ [Conditional("DRAGONECS_ENABLE_POOLS_EVENTS")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeOnGet(this List self, int entityID)
{
for (int i = 1; i < self.Count; i++) { self[i].OnGet(entityID); }
}
+ [Conditional("DRAGONECS_ENABLE_POOLS_EVENTS")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeOnDel(this List self, int entityID)
{
@@ -322,11 +331,13 @@ namespace DCFApixels.DragonECS
//
+ [Conditional("DRAGONECS_ENABLE_POOLS_EVENTS")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void InvokeOnAdd(this StructList self, int entityID)
{
for (int i = 0; i < self.Count; i++) { self[i].OnAdd(entityID); }
}
+ [Conditional("DRAGONECS_ENABLE_POOLS_EVENTS")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void InvokeOnAddAndGet(this StructList self, int entityID)
{
@@ -336,17 +347,18 @@ namespace DCFApixels.DragonECS
self[i].OnGet(entityID);
}
}
+ [Conditional("DRAGONECS_ENABLE_POOLS_EVENTS")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void InvokeOnGet(this StructList self, int entityID)
{
for (int i = 0; i < self.Count; i++) { self[i].OnGet(entityID); }
}
+ [Conditional("DRAGONECS_ENABLE_POOLS_EVENTS")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void InvokeOnDel(this StructList self, int entityID)
{
for (int i = 0; i < self.Count; i++) { self[i].OnDel(entityID); }
}
}
-#endif
#endregion
-}
+}
\ No newline at end of file