How to Make the Camera Move Vertically When the Player Does

I’m working on a top down game and am having trouble making the camera move up with the player. What I mean by this is lets say the player goes up a ramp. The Player moves up on the y axis but the player doesn’t move with it, making the player appear bigger it is closer to the camera.

I tried making the Camera a child of the player but while it did fix my problem it also made it so the camera turned with the player.

Here is my code for the camera

using UnityEngine;
using System.Collections;

public class GameCamera : MonoBehaviour {

	private Vector3 cameraTarget;

	private Transform target;
	
	void Start () {
		target = GameObject.FindGameObjectWithTag("Player").transform;
	}

	void Update () {
		cameraTarget = new Vector3(target.position.x,transform.position.y,target.position.z);
		transform.position = Vector3.Lerp(transform.position,cameraTarget,Time.deltaTime * 8);
	}
}

Here is the code for my player

using UnityEngine;
using System.Collections;

[RequireComponent (typeof (CharacterController))]
public class PlayerController : MonoBehaviour {

	// Handling
	public float rotationSpeed = 450;
	public float walkSpeed = 7;
	public float runSpeed = 10;

	// System
	private Quaternion targetRotation;

	// Components
	private CharacterController controller;


	void Start () {
		controller = GetComponent<CharacterController>();
	}

	void Update () {
		Vector3 input = new Vector3(Input.GetAxisRaw("Horizontal"),0,Input.GetAxisRaw("Vertical"));

		if (input != Vector3.zero) {
			targetRotation = Quaternion.LookRotation(input);
			transform.eulerAngles = Vector3.up * Mathf.MoveTowardsAngle(transform.eulerAngles.y,targetRotation.eulerAngles.y,rotationSpeed * Time.deltaTime);
		}

		Vector3 motion = input;
		motion *= (Mathf.Abs(input.x) == 1 && Mathf.Abs(input.z) == 1)?.7f:1;
		motion *= (Input.GetButton("Run"))?runSpeed:walkSpeed;
		motion += Vector3.up * -8;

		controller.Move(motion * Time.deltaTime);
	}
}

Change

cameraTarget = new Vector3(target.position.x,transform.position.y,target.position.z);

To

cameraTarget = new Vector3(target.position.x,target.position.y + 10f,target.position.z);

Where 10f is the height the camera should maintain above the player.

int the update function int the variable cameraTarget the y is set to transform.position.y when it should be target.position.y [with some height added like +120]

how camera follow a
Successive of Button in vertical ,when we do not have any player.118080-s.png