Hi!, Im trying to spawn a cylinder at different locations, here is what I have, am I missing something?
public Transform[] possibleSpawnPositions;
public GameObject objectTypeToSpawn;
public void SpawnNewObject() {
Transform spawnPointReference = GetSpawnPointReference();
Transform newObject = Instantiate(objectTypeToSpawn, spawnPointReference.position, spawnPointReference.rotation) as Transform;
}
public Transform GetSpawnPointReference() {
int randomIndex = Random.Range(0, possibleSpawnPositions.Length);
return possibleSpawnPositions[randomIndex];
}
}