Mar*_*dis 4 game-engine unity-game-engine navmesh
我正在统一制作游戏,它抛出错误“由于没有有效的NavMesh而无法创建代理”,而且我不知道问题出在哪里。
using UnityEngine;
using System.Collections;
public class EnemyMotion : MonoBehaviour {
public NavMeshAgent agent;
public Rigidbody rb;
public GameObject otwt;
void Start () {
rb = GetComponent<Rigidbody>();
agent = GetComponent<NavMeshAgent>();
}
void Update () {
gameObject.transform.Rotate(270, 0, 0);
agent.SetDestination(otwt.transform.position);
}
}
Run Code Online (Sandbox Code Playgroud)
这将烘焙NavMesh,您的NavMeshAgent现在可以工作了。现在您没有NavMesh,因此您的特工不知道他们可以在哪里移动/行走。