I am thinking of creating an enemy that exclusively follows the Y position of my player and am trying to imagine how that script would look.
A basic following script is the following:
void Update () {
transform.LookAt (player);
transform.position = Vector3.MoveTowards(transform.position, player.position, 1*Time.deltaTime);
I cannot see changing MoveTowards to something else as being a way of following the Y position, so would it instead replace transform.position?
I am also thinking about the range at which an enemy follows the player. I have thought of making a range script with a trigger collider acting as the ranges field. Is there a more experienced programmer who can tell me if that would be the right thing to do?