so I have a function with nested loops to initialize an object over and over in various places. The function does work the first time, but when I call it again after changing the values of the parameters it wont run, it just gets skipped over entirely.
function Start(){
//var startPoint = new Array(0, 0, 0);
//var endPoint = new Array(width, height, depth);
var startPoint = new int[3];
var endPoint = new int[3];
startPoint = [0,0,0];
endPoint = [width, height, depth];
//endPoint = [Random.Range(-10,10), Random.Range(-10,10), Random.Range(-10,10)];
//sectionCheck = checkSection(startPoint, endPoint);
startPoint = createSection(startPoint, endPoint);
print('first start: ' + startPoint[0]);
startPoint = planSection(startPoint, endPoint);
print('2cd start: ' + startPoint[0]);
endPoint[0] = 5;
endPoint[1] = 4;
endPoint[2] = 3;
startPoint = createSection(startPoint, endPoint);
print('3rd start: ' + startPoint[0]);
}
function createSection(start, end){
//print(start[0]);
for(var x = start[0]; x < end[0]; x++){
for(var y = start[1]; y < end[1]; y++){
for(var z = start[2]; z < end[2]; z++){
print('new brick'+x);
Instantiate(brick, Vector3(x,y,z), Quaternion.identity);
}
}
}
start = end;
return start;
}
print(‘new brick’+x); fails to run the second time I call the function. I have checked to make sure the parameters have values it needs. Is there something I am not understanding about calling functions?
Thanks a lot