RTS Style Unit: How to surround enemy when attacking

Im making an RTS game and have units that will attack each other when I give my unit the command to attack. If my unit cannot see the enemy unit I want it to go closer to the enemy. Heres my problem: I want my unit to go closer to the gameobject -which right now it does- but I want each unit I send to attack the enemy to “circle” the enemy so that it has a clear line of sight to the enemy and no other friendly units are in the way blocking its sight. Im not sure what would be the best way of doing this. Ive already researched how to create a circle of gameobjects as points to move to around the enemy gameobject then I was thinking about moving the units to the closest point?


Recap: Each new friendly unit to attack the enemy gameobject should move next to another friendly unit that is already attacking the enemy gameobject creating a “semicircle” depending on how many units there are


What would be the best way of doing this? Please comment if you don’t understand!! Thank you.

Use the NavMesh and every Unit (Friendly and Enemy) is a Obstacle