Привет всем, я новичок в Unity и обучаюсь по оф курсах Unity. Делаю все, как написано
https://connect-prd-cdn.unity.com/20190913/3f036af4-243a-44ff-98c5-1dc33fb33e0a/Lesson%20Plan%201.3%20-%20High%20Speed%20Chase.pdf?_ga=2.184476389.274498178.1610924748-1825644422.1610924748 , но возникат проблема: UnassignedReferenceException: The variable player of FollowPlayer has not been assigned.
You probably need to assign the player variable of the FollowPlayer script in the inspector.
FollowPlayer.LateUpdate () (at Assets/Scripts/FollowPlayer.cs:18), с кодом:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FollowPlayer : MonoBehaviour
{
public GameObject player;
private Vector3 offset = new Vector3(0, 5, -7);
// Start is called before the first frame update
void Start()
{
offset = transform.position - player.transform.position;
}
// Update is called once per frame
void Update()
{
transform.position = player.transform.position + offset; //проблемная строка
}
}