Unity5 - "简历"只能在已放置在NavMesh上的活动代理上调用

时间:2017-12-24 18:36:02

标签: unity3d 3d unityscript

Here are the errors i'm getting

在互联网上,他们说"打开窗口","点击导航"然后点击“烘焙”按钮"。我已经做到了,但没有做任何事情?

 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);

my floor is also navigation static

0 个答案:

没有答案