New to all this and not sure what im missing. Trying to spawn/pool multiple objects. I appreciate any help, like i said im a bit new. so still learning a few things, so dont be too harsh on me.
{
private static PoolManager _instance;
public static PoolManager Instance
{
get
{
if (_instance == null)
{
GameObject go = new GameObject("PoolManager");
go.AddComponent<PoolManager>();
}
return _instance;
}
}
public GameObject obstPrefab;
public int obstaclesToSpawn = 20;
public List<GameObject> obstacleList = new List<GameObject>();
void Awake()
{
_instance = this;
}
void Start()
{
for(int i = 0; i < obstaclesToSpawn; i++)
{
GameObject obstacle = Instantiate(obstPrefab, Vector3.zero, Quaternion.identity) as GameObject;
obstacle.transform.parent = this.transform;
obstacleList.Add(obstacle);
}
}
}