From b910c9d0e221f02c312b70e98ad265913863ac36 Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Sun, 3 Mar 2024 04:53:40 +0800 Subject: [PATCH] optimize GetComponents debug method --- src/EcsWorld.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/EcsWorld.cs b/src/EcsWorld.cs index 594df35..99c899a 100644 --- a/src/EcsWorld.cs +++ b/src/EcsWorld.cs @@ -628,7 +628,10 @@ namespace DCFApixels.DragonECS { list.Clear(); var itemsCount = GetComponentsCount(entityID); - + if (itemsCount <= 0) + { + return; + } int poolIndex = entityID; uint bit; for (int chunkIndex = 0; chunkIndex < _entityComponentMaskLength; chunkIndex++) @@ -663,7 +666,10 @@ namespace DCFApixels.DragonECS { typeSet.Clear(); var itemsCount = GetComponentsCount(entityID); - + if(itemsCount <= 0) + { + return; + } int poolIndex = entityID; uint bit; for (int chunkIndex = 0; chunkIndex < _entityComponentMaskLength; chunkIndex++)