using UnityEngine; public class CameraChaser : MonoBehaviour { public Transform target; public float distance; void Update() { if (target != null) { Vector3 newPosition = target.position; newPosition.z -= distance; transform.position = newPosition; } } }