Very Simple camera follow

simple camera follow, you can use Unity Inspector to drag in the player object, or it will find it for you if you forget to drag it in
[SerializeField] allows the variable to remain private in C#, but accessible in Unity’s Inspector

public class CameraFollow : MonoBehaviour {

[SerializeField] GameObject playerGO;

void Start() {
    if(playerGO == null) 
        playerGO = GameObject.FindGameObjectWithTag("Player");
}

void LateUpdate() {
    transform.position = playerGO.transform.position;
}

Privacy & Terms