¬_¬ Delete this…
``When you have set the distance you have to be before attacking you can do something along the lines of this:
var speed : float = 3;
var diffVector: Vector3 = target - transform.position;
var movement : Vector3;
if(diffVector.magnitude > 1){
movement = (diffVector.normalized * speed);
}
This will prevent the enemy from slowing down when it gets closer to the target.
However in my own experience of enemyAI it’s better to add a collider that is trigger then if the player is in that area you can start the animation playing etc.