- Home /
Question by
zakwaddington · Aug 13, 2018 at 06:37 PM ·
assign-variable
It says the variable player of camera_follow has not be assigned,It says The Variable player of Camera_Follow has not been assigned even though there is no error in the script and i have already assigned the script to the camera
I'm trying to build a script for a camera to follow the player and i have assigned the script to the camera, i have tagged the player and there isn't a visible error in the script
This is the script:
using UnityEngine;
public class Camera_follow : MonoBehaviour {
public Transform player;
public Vector3 offset;
// Update is called once per frame
void Start ()
{
offset = transform.position - player.transform.position;
}
void LateUpdate ()
{
transform.position = player.position + offset;
}
}
Does anyone know how i can resolve this? thanks
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612172742im_/https://answers.unity.com/themes/thub/images/avi.jpg)