Check Collision In Editor Mode

Hi,

Is there a way to check object collision in Editor mode? Right now I have a custom inspector that instantiates a bunch of cubes, and I want to delete the cubes that collide with previously existing level geometry. Thanks.

2 Answers

2

The ExecuteInEditMode didn't work for collision functions, so what I ended up doing was using Physics.OverlapSphere to check for colliders in approximately the area of each cube before I spawned it. This is a bit rough since it uses a sphere instead of a cube, but it works fine for what I need.

It works perfectly for me, put the OverlapBox inside the OnDrawGizmos method, it works like magic, thanks !

–

This will probably help: http://unity3d.com/support/documentation/ScriptReference/ExecuteInEditMode.html