Raycasting within a certain area

Hi,
I´m trying to create a simple strategy game for my tablet device, however, I´m a bit stuck in the unit selection controll. I´ve already created a click selection, but I´d also like to make a mass selection (you move your finger over the area and when you release, you select all units within the rectangle).
I´ve thought about this, and the only solution that occurred to me, is to RaycastAll(), check if the gameobject is in the “Units” layer and compare its position with the touchStart and touchEnd positions. Does anyone know of a better way to do this ? Because my approach seems to me quite inefficient.

Thanks in advance

RaycastAll returns everything the ray hits rather than the first one, it’s still just a single line.

I’ve seen people generate a mesh rectangle (might have been a quad) based on the start/end position and check for collisions with units using that before with some success.

Thanks, I´ll try it :slight_smile: