Unity3D 导航寻路

先选择Window-->Navigation 在新打开的窗口中点击Bake.

待烘焙结束之后。

给需要导航的物体添加NavMeshAgent组件。可以调整速Speed Radius 等。

然后

1 NavMeshAgent agent = this.GetComponent<NavMeshAgent>();
2 //设置目标
3 agent.SetDestination(player.position);
4 //停止
5 agent.Stop();
原文地址:https://www.cnblogs.com/Akishimo/p/4758614.html