I attached this code to an empty gameobject and am not sure why my block prefabs are not spawning. I’ve gotten it to work in previous games I’ve created but am confused why it no longer works in new games. I must be doing something wrong.
var block1 : GameObject;
var index : int = 0;
var worldWidth :uint = 500;
var worldHeight : uint = 500;
function Start () {
CreateWorld();
}
function Update () {
}
function CreateWorld() {
for(var x : uint =0; x<worldWidth; x+=25) {
Debug.Log("SPAWN1");
for(var z : uint =0; z<worldHeight; z+=25) {
Debug.Log("SPAWN2");
var block = Instantiate(block1);
block.transform.position = new Vector3(x, block.transform.position.y , z - 20);
}
}
}