Looking at the Player in Unity
Oct 30, 2021
This tutorial will cover always having the camera look at the player and track the player as they move across the screen. First create a new script called LookAtPlayer. Add the script to your main camera.
In the script you will not need the start function so you can delete that. Add a transform variable that will reference the player. Then in the update script call transform.LookAt and pass it your player variable.
[SerializeField] private Transform player;// Update is called once per frame
void Update()
{
transform.LookAt(player);
}
Make sure you assign your Player to the player variable in the Unity editor.
That is all you need for your camera to stay focused on the player as they move about the level.
-Chris