When, in the frame, do colliders generate?

I have a “for” loop in an update, that randomly generates a point in a given circle. Then a tree is instantiated within that circle (it’s a tree brush tool).
Now to stop trees overlapping, each tree has a collider. When I instantiate a tree it raycasts down to make sure that it isn’t hitting a collider.
Whats happening is that it’s generating the trees without the colliders, waiting till the next frame or end of the current frame before even making the colliders.
What this means is that the 7 trees that I instantiate using the “for” loop, ignore each other’s colliders. It wont generate a tree if it hits a tree you made the frame before, but for the 7 you generate using that “for” loop, they can be as close together as they want.
I guess this means is that the colliders are either generating at the end of the current frame, or at the start of the next frame, so its generating all 7 trees in the for loop at once, and generates colliders after. do you have any ideas?
If that didn’t make any sense, this should:
Whats happenening is if you click, the trees will occasionally massively overlap and itll look odd.
However on the next click, it’ll never overlap with the trees you placed on the previous frames.
If you can enlighten me as to why this is happening and what I can do to fix it, cheers. :slight_smile:

Ok solved this myself. Well not solved… found out you cant. Physics data is updated by the timestep in project settings>time. So its not even calculated every frame.
Solution was to store the Vector3 position of every tree this frame, and find the Vector3.Distance between all the points in the positions array and the current position.
If the distance is less than, say 1.2f, then set that placement to invalid, and get a new random point to place a tree.
A problem with this is lets say you were going to place something quicker that the timestep (I think default is 0.1 seconds so you would need to click the mouse more than 10x per second) then you would need to extend the array to last until the current timestep has ended, and the colliders would become active. This wouldn’t be too difficult to do, just say
“if (Time.time - timeStep > lastTimeStepTime) then reset array”
But yea. Sorry if anyone else had this problem. Nothin you can do about it unless Unity 5 either gets very efficient at physics calculations to be able to do it whenever a new collider is created or is set to move in a script, or computers get so fast you can set the time step to something crazy like 0.00001.