Greetings!
Im pretty new to unity so bare with me if this problem has already be dealt with somehow, but my search did not turn up with much information.
My problem is as follws: I instantiate 32x32x32 Cubes with a script in my scene as soon as its loaded. Now all cubes are the same so i dont think there should be a problem with too many draw calls, but anyhow the performance goes from nearly unbearable to not existent.
Do you know what the problem is?
Beyond is the code im using:
public GameObject prefab;
public float gridX = 5;
public float gridY = 5;
public float gridZ = 5;
public float spacing = 2.0F;
public GameObject closeTileDepth;
void Start () {
for (var y = 0; y < gridY; y++)
{
for (var x = 0; x < gridX; x++)
{
for (var z = 0 - gridZ; z < 0; z++)
{
var pos = new Vector3(x, z, y) * spacing;
GameObject obj = (GameObject)Instantiate(prefab, pos, Quaternion.identity);
}
}
}
}