i want to make my camera stop following player when the player died but in the last player position, i’ve tried different code but still not working,here’s the code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraFollow : MonoBehaviour
{
public float FollowSpeed = 2f;
public float yOffset = 1f;
public Transform target;
public PlayerStat stat;
void Update()
{
cameraFollow();
cameraDead();
}
private void cameraFollow()
{
Vector3 newPos = new Vector3(target.position.x, target.position.y + yOffset, -10f);
transform.position = Vector3.Slerp(transform.position, newPos, FollowSpeed * Time.deltaTime);
}
private void cameraDead()
{
if (stat.isDead)
{
//code
}
}
}