Hi, is there any way anyone can help me with this situation? When the player falls into the "void" the player dies. However, the camera follows with him. here is the code: Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraFollow : MonoBehaviour { public GameObject player; private Vector3 offset; public bool gameOver; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { transform.position = player.transform.position + offset + new Vector3(5, 5, -15); if (gameOver == true) { transform.position = new Vector3(0, 0, 0); } if (gameOver == false) { transform.position = player.transform.position + offset + new Vector3(5, 5, -15); } } } Please help if you can. Thanks.
What happens when your player dies? Do you destroy the player? What you can do is use the gameover bool true if statement to set your camera position to prevent it from following the player and it seems you've already done that actually, that's a bit weird. Edit: OH! I just realised what you did! Code (CSharp): transform.position = player.transform.position + offset + new Vector3(5, 5, -15); if (gameOver == true) { transform.position = new Vector3(0, 0, 0); } if (gameOver == false) { transform.position = player.transform.position + offset + new Vector3(5, 5, -15); } Should be Code (CSharp): if (gameOver == true) { transform.position = new Vector3(0, 0, 0); } if (gameOver == false) { transform.position = player.transform.position + offset + new Vector3(5, 5, -15); } You were constantly updating the camera's transform position every frame and that piece of code in the update function was ignoring your if statements, your code was otherwise correct though.