Raycast fails when in loop but not Update()

I am trying to use a bit of code to stack bricks on top of each other in a random way.

In a for loop, I instantiate a brick, raycast down from it and it lands on either the base or whatever brick is below it. It’s supposed to stack up, but the raycast always goes through the bricks and hits the base, making them all be at the same level of Y.

if I replace the for loop with Update() and use the exact same code so it puts a brick down every frame, they stack up perfectly. How do I do this in a single bit of code? Is there something weird about raycasting that prevents this from working in this situation?

for(var a=0; a<20; a++){

step++;
if(step==3){
step=0;
}

var block:GameObject = Instantiate(Resources.Load(“doorways/brick”) as GameObject);

block.transform.parent = gameObject.transform;
block.layer = 16;

var bx =(u.ran(20)-10)/1000;
if(step==0){
var bz = 1.7-(u.ran(10))/10;
}else if(step==1){
bz = .7-(u.ran(10))/10;
}else if(step==2){
bz = -.3-(u.ran(10))/10;
}

var layerMask = 1 << 16;
var hit : RaycastHit;
var direction:Vector3 = new Vector3(0,-1,0);
var start:Vector3 = new Vector3(bx, 200, bz);

if (Physics.Raycast (start, direction, hit, 305, layerMask)) {
Debug.Log(hit.transform.gameObject.name+" / "+a);
block.transform.position.y=hit.point.y;
block.transform.position.z=hit.point.z;
block.transform.position.x=hit.point.x;
}

}

bump?