Working generic object pooling, pool monitor editor tool and batch component adder editor tool

This commit is contained in:
Michal Pikulski
2025-09-16 15:02:50 +02:00
parent bcc6f05058
commit 75be338065
26 changed files with 1393 additions and 469 deletions

View File

@@ -1,4 +1,5 @@
using UnityEngine;
using Pooling;
namespace Minigames.DivingForPictures
{
@@ -43,6 +44,11 @@ namespace Minigames.DivingForPictures
_bubblePool.initialPoolSize = initialPoolSize;
_bubblePool.maxPoolSize = maxPoolSize;
_bubblePool.Initialize(bubblePrefab);
// Periodically check for pool statistics in debug builds
#if DEVELOPMENT_BUILD || UNITY_EDITOR
InvokeRepeating(nameof(LogPoolStats), 5f, 30f);
#endif
}
}
@@ -112,5 +118,16 @@ namespace Minigames.DivingForPictures
// Pass min/max scale for wobble clamping
bubble.SetWobbleScaleLimits(wobbleMinScale, wobbleMaxScale);
}
/// <summary>
/// Logs the current pool statistics for debugging
/// </summary>
private void LogPoolStats()
{
if (_bubblePool != null)
{
_bubblePool.LogPoolStats();
}
}
}
}