My RTS drag select selects all units of the same type. For example when I try to select one archer, all the archers are selected across the map. Any ideas?
For some reason I can’t open your pastebins but what I can suggest you to do is have a selection script which can handle different type of selections, like single click selection and square box selection.
The single click one would work only if the position of the mouse is same or almost the same when the click starts (Input.GetMouseKeyDown) and when it is released (Input.GetMouseKeyUp) and cast a ray from the mouse position using physics.raycast(camera.screenToWorldPoint. etc) and selecting the unit it collides with.
Then the square selection would work by making a Rect defined by the start position of the mouse when your click starts and the dynamic position while it is being holded Input.GetMouseKey(0) and then when it is released get the coords of when it was released and use them together with the starting coords to create a 2D Rect() and then what you do, is for every unit on screen (use renderer.isVisible) use Rect.contains to see which units are inside the Rect and then those units make them selected the way to want to, using a tag, variable inside the unit, etc.
Hope it helps If you have problems with the Rect let me know, its a bit tricky because of how the axis work on mouse screen space and the axis on Rect work (x is the same and y is from top to down instead from down to top).