I have this Code:
while(i < SpawnAmountStart) {
Vector3 newPosition = new Vector3(i * floatx, floaty, floatz);
Instantiate(PrefabArray[Random.Range(0, PrefabArray.Length)], newPosition, Quaternion.identity);
i++;
generatedstart = true;
allgenerated++;
}
It can the Prefabs into the “x” direction, but it can’t generate into the “z” and “y” direction. And I don’t find the error. Where is my problem?
You are only changing the spawn location on the x axis.
Vector3 newPosition = new Vector3(i * floatx, floaty, floatz);
What do you mean? I have
floatx = 0;
floaty = 10;
floatz = 0;
If floatx is 0 it shouldn’t be spawning in any direction (since anything * 0 = 0).
If you want it to spawn on the y axis:
Vector3 newPosition = new Vector3(floatx, i * floaty, floatz);
If you want it to spawn on the z axis:
Vector3 newPosition = new Vector3(floatx, floaty,i * floatz);
Ohhh, I am so stupid -.-
Thx 