First of all, if you know a better way to do what I want to achieve please don't hesitate to suggest your own method.
What I want to do is the classic area selection in RTS games, which player drags his mouse to draw a rectangle and units inside rectangle become selected.
At this point, I have two ideas:
- A dedicated gameObject with a trigger BoxCollider2D.
- Detecting overlaps with Physics2D.OverlapArea method.
In the first method, the gameObject will get resized on the fly while the user drags and by using collision control the objects get selected.
In the second method starting point and end point of the area is being recorded and script draws an OverlapArea using these two coordinates.
Which one would be more effective in terms of performance?
Thanks in advance.