Detecting collision from Instantiated objects

hey,
i’ve written a quick script that spawns 500 cubes randomly in the volume of a sphere, however i’ve been unable to find a system to stop the Instantiated objects from intersecting when they spawn.

i know this SHOULD be possible, but with Unity’s unhelpful obuste collision detection system i’ve found it very difficult to work out.

the cubes that i am spawning will be used as collision objects in the game, so they have colliders attached, but i’ve found no way to reliably destroy any cube that spawns inside another.

i’ve been trying to figure this out for two days now, so any help is welcome.

thanks in advance

You can iterate over each previously spawned object and check bounds: http://unity3d.com/support/documentation/ScriptReference/Bounds.Intersects.html