我一直在为僵尸创造人工智能,不知从哪里,我得到了这个错误信息。这是密码。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class ZombieController : MonoBehaviour
{
private NavMeshAgent agent = null;
[SerializeField] private Transform target;
private void Start()
{
GetReferences();
}
private void Update()
{
MoveToTarget();
}
private void MoveToTarget()
{
agent.SetDestination(target.position);
}
private void GetReferences();
}发布于 2022-06-17 18:18:12
此代码导致了以下问题:
private void GetReferences();这是因为您通常会定义这样的函数,比如您是如何实现它的:
private void MoveToTarget()
{
agent.SetDestination(target.position);
}您需要对GetReferences()这样做;
private void GetReferences()
{
//Type your code here
}然后,您可以像使用下面的代码那样在Update中调用它。
GetReferences();基本上,您还没有定义GetReferences();希望这有所帮助!如果你还有什么问题请告诉我。:)
https://stackoverflow.com/questions/72662326
复制相似问题