How to change between pathfinding destinations?
I am making a roguelike in unity 2d and my I use the Astar Pathfinding Project for my enemies. I have an enemky that does a melee attack. This means that it doesn´t just stop at the same position as the player. It stops on the player´s left or right side, depending on the direction the enemy was, and then starts its melee attack at the player. For doing this, I have 2 empty objects on both sides of the player, and a code that changes the pathfinding AI Destination Setter depending on the velocity o0f the enemy. When I had capsules as objects it worked just fine, but now that I implemented sprites my enemy has multiple errors, such as changing every frame its destination like crazy when it reaches the player position, being unable to decide which path to choose. Is there a way I can do this easily, since melee enemies are a really common things in videogames and I am really new in this field?