1. First add the scene model
2. Add Navmesh render for scene model (pathfinding path), Operation:windows->navigation-> tick Navigation static option, uncheck Generate option->navigation Area selected as Walk Able->back bar Adjust agent radius parameter->bake button to complete pathfinding rendering
3. Add nav Mesh Agent components for moving objects
4. Add a script to the object you want to move
usingUnityengine;usingUnityengine.ui;usingSystem.Collections; Public classBasstest:monobehaviour {//Mobile Control Privatenavmeshagent Car; //Cargo model, direct drag PublicGameobject Goods; //Target point (set to static if you want to call the program) PublicVector3 Target; voidAwake () {Car= gameobject.getcomponent<navmeshagent> ();Target=transform.position; } voidUpdate () {car.setdestination (target); }}
"Unity3d" Automatic pathfinding (Nav Mesh agent component)