so i got this for loop to spawn a series of empty objects at a certain distance from each otehr, its the first time i use “new GameObject” so im not sure if its supposed to spawn two game objects or if im doing something wrong. here is the code:
public GameObject sun;
//public Vector3[] sunPosXAxis;
//public Vector3[] sunPosYAxis;
public int planetAmount;
public float planetSpacing;
public GameObject[] planetSpawn;
public Vector3[] planetsPos;
// Use this for initialization
void Start () {
Instantiate(new GameObject("Sun"), Vector3.zero, Quaternion.identity);
SpawnPlanets();
}
void SpawnPlanets () {
for (int i = 0; i < planetAmount; i++){
GameObject clone = Instantiate(new GameObject("Planet_Spawn" + i), new Vector3(planetSpacing * i, 0, 0), Quaternion.identity) as GameObject;
planetsPos *= clone.transform.position;*
-
}*
- }*
if someone knows why it does this or how to stop it pls tell me, thank you all