在互联网上,他们说"打开窗口","点击导航"然后点击“烘焙”按钮"。我已经做到了,但没有做任何事情?
do
{
//RESUME WALKING
navAgent.Resume();
//pick a random location to roam
var newDestination = roamPoints[Random.Range(0, roamPoints.Length)];
navAgent.SetDestination(newDestination.transform.position);
while (true)
{
//if we are not nav mesh stop
if (!navAgent.isOnNavMesh)
{
Debug.LogError("EnemyAI is not a navmesh!");
//Vector3 warpPosition = new Vector3(0,0,0);
//navAgent.transform.position = warpPosition;
//navAgent.enabled = false;
//navAgent.enabled = true;
yield break;
}
if (!navAgent.pathPending && //we are not calculating path
navAgent.remainingDistance <= navAgent.stoppingDistance &&
(!navAgent.hasPath || navAgent.velocity.sqrMagnitude == 0f)) break;
yield return null;
}
float timeSincePause = 0.0f;
while (timeSincePause < pauseTime)
{
timeSincePause += Time.deltaTime;
yield return null;
}
} while (state == State.Roaming);