Quick answer: Define area types in Navigation Areas. Assign Area Type on each NavMeshLink. Set per-agent cost via agent.SetAreaCost(area, cost). The pathfinder weights paths by cumulative area cost, picking cheaper routes.
You add a Jump link from a high ledge to the ground. Set the link Area = Jump with cost 5. AI still takes a long way around. Costs need both the link tag and per-agent overrides.
The Symptom
Agents either always use a NavMeshLink (you wanted them to avoid) or never use it (you wanted them to prefer). Default Area Walkable with cost 1 means everything looks equally cheap.
The Fix
Step 1: Define area types. Window → AI → Navigation → Areas tab.
Walkable: 1
Jump: 5
Swim: 10
Sneak: 15
Default costs apply unless an agent overrides.
Step 2: Assign on the NavMeshLink.
NavMeshLink Inspector:
Area Type: Jump
Bidirectional: true
Auto Update Position: true
Step 3: Per-agent cost override.
public class AgentInit : MonoBehaviour
{
NavMeshAgent agent;
void Start()
{
agent = GetComponent<NavMeshAgent>();
agent.SetAreaCost(NavMesh.GetAreaFromName("Jump"), 3.0f); // this agent prefers jumping
agent.SetAreaCost(NavMesh.GetAreaFromName("Swim"), 100f); // this one avoids water
}
}
Path Visualization
Window → AI → Navigation → Areas. Tick “Show Areas” in the Scene view. NavMesh chunks color by area type. Confirms link covers the intended span.
Verifying
Spawn the agent, give it a target across the link. With a low Jump cost, agent uses the link. With a high cost, agent walks around. Tune by trial.
“Areas defined. Link tagged. Per-agent cost. Paths reflect preferences.”
Related Issues
For NavMeshAgent stuck, see NavMesh corner. For multiple agent types, see multiple agent types.
Tag links. Tune costs. Paths bend.