From f46f730535afbeda088b2fe9fecd1bf1c03c6cf3 Mon Sep 17 00:00:00 2001 From: Lucas Girouard-Stranks Date: Fri, 3 Jul 2020 12:53:17 -0400 Subject: [PATCH] Set capacity for ObjectPool in the constructor --- Source/MonoGame.Extended/Collections/ObjectPool.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/MonoGame.Extended/Collections/ObjectPool.cs b/Source/MonoGame.Extended/Collections/ObjectPool.cs index 829491c7..066fa965 100644 --- a/Source/MonoGame.Extended/Collections/ObjectPool.cs +++ b/Source/MonoGame.Extended/Collections/ObjectPool.cs @@ -41,7 +41,9 @@ namespace MonoGame.Extended.Collections _instantiationFunction = instantiationFunc; _freeItems = new Deque(capacity); - IsFullPolicy = isFullPolicy; + IsFullPolicy = isFullPolicy; + + Capacity = capacity; } public IEnumerator GetEnumerator()