Detecting object collision in Start

I’ve got a script that instantiates several game objects from prefabs within Start. Every time I instantiate a new object, I want to check that it doesn’t intersect with any of the existing objects. This all has to be done within Start so that everything is in place and not overlapping once the game begins.

My prefabs need to contain a Mesh Filter, Mesh Renderer, and a Mesh Collider.

First I tried using Physics.CheckBox:
My script contained:

var s = module.GetComponentInChildren ().mesh.bounds.size / 2f;
if (Physics.CheckBox (module.transform.position, s, module.transform.rotation)) {

In which case all the modules get destroyed. I tried dividing by 100f instead, which worked a little better, but still not very reliable or accurate. I also tried adding a rigid body to each of the prefabs, but that didn’t change anything. I’m not really sure this is the best method of detecting anyways, since most of my modules are not box (or sphere) shaped.

Then I tried an OnTriggerEnter/OnCollisionEnter method:
I added an addition Mesh Collider on each prefab, and marked the Trigger and Convex boxes. Then in my script I implemented

void OnTriggerEnter(Collider a) {
    this.collided = true;
void OnCollisionEnter(Collision a) {
    this.collided = true;

And I just check the collided field of the object after it had been initialized and placed by the main script. This didn’t do anything at all, the function appears to never be called.

I poked around some to find alternative ways to accomplish this, but didn’t find anything useful. Can anyone see where I’m messing up or suggest a better method?

It’s hard to say exactly what could be going wrong here. I recommend using some

Debug.Log("box:" +module+ "will be destroyed" )

(or some similar) statements to understand what code is being run at runtime. This will help you narrow your question. I tend to use triggers for this sort of thing, and your trigger code is correct. If something isn’t being called as you expect investigate just that part of the question. I would focus just on triggers… It could be your objects are on layers which don’t collide, or it could be that you didn’t update the prefab you want to spawn with the object that is marked as Trigger.
You don’t need a rigidBody to make a boxCollider/meshCollider work… Note that An object can’t call it’s on trigger method till after it starts. Try just placing them on top of each other in the editor (without running the spawner) with a few debug.Log statements (no logic) and watch what happens.