look at target problem

i am using the

transform.lookat(target);

TO MAKE MY ENEMY LOOK AT THE PLAYER
now if you try this you can see if we go close to the enemy and jump he will lie down somehow
first i wanted to ignore him TO look at my y posittion!
now i dont know that is a good idea or not because enemy is dynamic and i think when following me that make problems if i do that

The typical way is to move the target point before doing the LookAt():

var pos = target.position;
pos.y = transform.position.y;
transform.LookAt(pos);

Alternate code that does the same thing:

var dir = target.position - transform.position;
dir.y =0.0;
transform.rotation = Quaternion.LookRotation(dir);

Robert’s answer is good. In case you need examples I specifically cover this in a tutorial on Unity Gems: unitygems.com - unitygems Resources and Information.