using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraController : MonoBehaviour { public Transform target; public float smoothSpeed = 0.25f; private void Awake() { } void Start() { target = GameObject.FindGameObjectWithTag("Player").transform; } void FixedUpdate() { Vector3 targetPosition = new Vector3(target.position.x, target.position.y, -1f); Vector3 smoothedPosition = Vector3.Lerp(transform.position, targetPosition, smoothSpeed); transform.position = smoothedPosition; } }