freeze cameras .x position

i want my camera to follow my player…
but my player doesnt have a stable speed so i cant use a script to move my camera up.
and if i set the camera child of my player the camera moves left and right??
what can i do??

thanks in advance

So you just want the camera to follow them vertically?

Just freeze the position via script:

public void LateUpdate()
{
    transform.position = new Vector3(0, transform.position.y, transform.position.z);
}
1 Like

AWESOME THANKS MATE…JUST WHAT I WANTED!!!