I’m making a 2d RTS where you move units around and they would shoot at enemy units.
I want the player’s units to have an array that contains the enemies that are in its radius. And they will shoot the one at the top of the list. My question is, How can I do this through code?
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.CompareTag("Enemy"))
{
}
}