I have 2 objects, friendlysoldier and enemysoldier. Then a "cone of vision" object that gets spawned and set as child for each soldier on layout start. This is their line of sight.
If they don't have an opposite soldier inside this object, then they are told to calculate a path to nearest enemy and then move.
When their cone then overlaps with an enemy, I want the pathfinding to stop. But they don't, they just keep going until they are almost on top of the enemy.
This is how I have set it up:
'