I’m trying to make a very simple enemy that’s always facing the player. But transform.LookAt looks at it on all of the axis, where I want it to just be the y axis.
I tried this
transform.LookAt(new Vector3(target.transform.eulerAngles.x, transform.position.y, target.transform.eulerAngles.z));
but it has a problem where for some reason it’s not updating when the player moves. The enemy is always staring at the position where the player started and not where the player is. I’ve checked to make sure the target variable is correct and that the target transform is where I want it to be. I don’t know what causes the bug. I also added a log statement to see if it’s running sure enough it’s running each frame.