I am trying to make the camera follow the player, but it doesnt works. I have this error: UnassignedReferenceException: The variable player of PlayerFollow has not been assigned.
(actually I have already assigned the variable in the inspector wtf)
using UnityEngine;
public class PlayerFollow : MonoBehaviour {
public Transform player;
// Update is called once per frame
void Update () {
transform.position = player.position;
}
}
You have nothing assigned to player. Either you have to assign it by code, or you drag and drop the player into the player variable slot in the inspector.