LookAt fails at close range.

Hello, I am trying to get a missile to work in a 2D game. Normally I thought this would work, but it does not seem to.

I am just using transform.LookAt(target) to make the missile follow the enemy. But if the enemy is rotating a lot. It almost “loses interest” and stops moving and targeting. It usually happens when the missile is close.

Any ideas?
var target : Transform;
var speed : float = 20;

function Update () {
	transform.Translate(Vector3(0,0,speed)*Time.deltaTime);
	
	if(target){
		transform.LookAt(target);
	}
}

The only thing that comes to my mind is to maybe swap the two lines to make the missile first rotate (look-at) and then move.

Right now your rotation is always one frame late, depending on your stepsize and how much the target moves, there might be some funny artifacts when you get close to the target.

Another thing that might happen when you get close to the target, you might overstep and not notice it. This my result in being further away from the target then before.

So try swapping the two statements and playing around with the stepsize/speed value.