protected void LoadBalls() { var balls = Resources.LoadAll <Ball>("Balls"); foreach (var ball in balls) { GameObject obj = new GameObject(ball.name); Pooler a = obj.AddComponent <Pooler>(); a.Template = ball; a.PoolSize = BallPoolSize; a.FillPool(); DataPool.Add(ball.BallColor, a); } }