// Create pools of the enemies that we have in our container. public void InitializeWithPooler(IPoolManager pooler, int poolSize) { this.pooler = pooler; // Instantiate the enemies and set up their properties. for (int i = 0; i < enemyPrefabs.Length; i++) { PooledObject[] poolContainer = pooler.CreatePool(enemyPrefabs[i], poolSize); foreach (PooledObject poolObj in poolContainer) { // Initialize features of the enemies. IScore scorer = poolObj.GetComponent <IScore>(); if (scorer != null) { scorer.Initialize(scoreManager); } IPoolUser poolUser = poolObj.GetComponent <IPoolUser>(); if (poolUser != null) { poolUser.InitializeWithPooler(pooler, poolSize); } } } }