Random spawn at different locations

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];
}

}

Have you added that cylinder mesh in inspector, same as all spawn point? And array first element starts from 0, so it should be:

possibleSpawnPositions.Length-1;

Here is a similar question i answered.