Unity2D Animation issues

So I have a flying enemy and to make it more lively I want it to be animated going up and down. I got the animation working but the enemy no longer follows the player. I made sure to remove the x,z properties from the animation but the controller no longer moves the character it’s adding velocity and everything.

if its continuous motion you should write a script that moves the enemy instead of animation because animation will override the physics.

void LateUpdate(){
transform.position = initialPos + new Vector3(0f,Mathf.Sin(Time.time),0f);
}