Raycast hits multiple targets

I have to seperate box colliders next to eachother, which are very little and supposed to activate lights, but however when i try to select a single one of them they both activate! aargh! help!:stuck_out_tongue:

thanks in advance!

If you only want the raycast to hit a particular collider, you can look into using Layers so the raycast ignores the one(s) you don’t want to hit.

If you just want it to return the first collider it hits then just use Raycast instead of RaycastAll.

It’s hard to say exactly how to do it because I’m not sure exactly what you’re trying to accomplish. There may even be a better way to do it without raycasting.