/// <summary> /// Prewarms the pool. /// </summary> public void Prewarm() { if (m_InnerPool == null) { Initialize(null, null, m_InitialPrewarm); } else { m_InnerPool.Prewarm(m_InitialPrewarm); } }
/// <summary> /// Initializes the pool. /// </summary> public void Initialize(Transform inPoolRoot = null, Transform inSpawnRoot = null) { if (m_InnerPool != null) { throw new InvalidOperationException("Cannot load pool twice"); } if (inPoolRoot == null) { inPoolRoot = m_DefaultPoolRoot; } if (inSpawnRoot == null) { inSpawnRoot = m_DefaultSpawnRoot; } if (!inPoolRoot) { throw new ArgumentNullException("inPoolRoot", "No pool root, and no default pool root"); } m_InnerPool = new PrefabPool <T>(Name, m_InitialCapacity, m_Prefab, inPoolRoot, inSpawnRoot, m_ResetTransformOnAlloc, !AllowLooseTyping()); m_InnerPool.Config.RegisterOnAlloc(OnAlloc); m_InnerPool.Config.RegisterOnFree(OnFree); if (m_PrewarmOnInitialize) { m_InnerPool.Prewarm(m_InitialPrewarm); } }
/// <summary> /// Prewarms the pool. /// </summary> public void Prewarm() { m_InnerPool.Prewarm(m_InitialPrewarm); }