unity报错:"SetDestination" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.AI.NavMeshAgent:set_destination(Vector3)
Enemy.<enemyPatrol>d__5:MoveNext() (at Assets/DiffuseRoad/EnemyScripts/EnemyPatrolController.cs:34)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
产生错误的原因是,代理(NavMeshAgent)不在网格(NavMesh)上,
排除错误的方法:
一、查看NavMeshAgent是否在网格上。
二、烘培所用的AgentType和NavMeshAgent的AgentType是否为同一种类型。
三、没有烘培NavMesh或者场景调整后,NavMesh没有及时的重新烘焙(Bake)