Zombie AI Help

I have a 2D zombie, that i want to look at the player. Not rotate the zombie, but just flip his x axis so he’s looking at the player.

Here is a helpful YouTube tutorial.

You don’t provide a script, so I have to guess at how you have thing setup. I’m assuming you are using a sprite for your zombie. I’m also assuming that your zombie faces right when its rotation is (0,0,0). With a sprite, it is better to flip it on the ‘x’ by rotating around the ‘y’ axis. Change the local scale (a common approach I see in question to UA), can result in problems with the collider. Merge this logic into your code:

#pragma strict

var player : transform;
   
function Start() 
    player = GameObject.Find("Player").transform;
}

function Update() {

	if (player.position.x < transform.position.x) {
		transform.eulerAngles = Vector3(0,180,0);
	}
	else {
		transform.rotation = Quaternion.identity;
	}
}