From 72925842b72dc40027a0c6e2a738bfbc18eb8972 Mon Sep 17 00:00:00 2001 From: Harrison Deng Date: Sat, 11 Jul 2020 11:45:03 -0500 Subject: [PATCH] Fixed object pool unlimited mode. --- .../Utilities/Collections/Pooling/ObjectPool.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SlatedGameToolkit.Framework/Utilities/Collections/Pooling/ObjectPool.cs b/src/SlatedGameToolkit.Framework/Utilities/Collections/Pooling/ObjectPool.cs index 412d701..149b390 100644 --- a/src/SlatedGameToolkit.Framework/Utilities/Collections/Pooling/ObjectPool.cs +++ b/src/SlatedGameToolkit.Framework/Utilities/Collections/Pooling/ObjectPool.cs @@ -24,7 +24,7 @@ namespace SlatedGameToolkit.Framework.Utilities.Collections.Pooling } public void CreateAmount(int amount) { - if (Size >= 0 && Count + amount >= Size) throw new FrameworkUsageException(string.Format("Object pool surpassed set size of {0}", Size)); + if (Size > 0 && Count + amount >= Size) throw new FrameworkUsageException(string.Format("Object pool surpassed set size of {0}", Size)); for (int i = 0; i < amount; i++) { pool.Add(creator()); } @@ -40,7 +40,7 @@ namespace SlatedGameToolkit.Framework.Utilities.Collections.Pooling } public void Release(Poolable poolable) { - if (Size >= 0 && Count + 1 >= Size) throw new FrameworkUsageException(string.Format("Object pool surpassed set size of {0}", Size)); + if (Size > 0 && Count + 1 >= Size) throw new FrameworkUsageException(string.Format("Object pool surpassed set size of {0}", Size)); poolable.Reset(); pool.Add(poolable); }