Change navmesh area cost at runtime

Is it possible to change a navmrsh cost at runtime to change how the AI autopaths based on character stats.


For example in my sample scene there is two half’s of land divided by a river. Joining the two half’s is a bridge on the far side opposite of the character. If the character has high intelligence and high stamina I want to reduce the cost of the bridge and increase the cost of the water. If the character has high intelligence and high swimming I want to increase the bridge cost and lower the water. Likewise if the character has low stats I want them to cost about the same.


More or less I want to autopath based on character stats so that higher stats in specific builds rewards the player in some way by transversing the map differently/quicker.


Is this possible with the navmeshagent?


Thanks for the help.

Have you tried modifying the area costs specific to an Agent using NavMeshAgent.SetAreaCost(int areaIndex, float areaCost)?

Apart from the Astar Pathfinding project mentioned by Cherno, you can also try Unity NavMeshComponents (manual: Unity - Manual: NavMesh building components).