Unity AI
引入unityengine.ai
给player加 Navagentmesh
public Navagentmesh player;
public transform target;
在start写
player=this.getcompent<navagentmesh>;
player.destination=target.position;
raycast hit;
if(physics.raycast(camera.main.screenPointToRay(Input.moousePosition),out hit,1000f)
player.destination=hit.position;