Skip to content

Api > NavMeshAgent > SetAreaCost()


NavMeshAgent.SetAreaCost(number areaIndex, number areaCost)⚓︎

Sets the cost for traversing over areas of the area type.

Parameters:⚓︎

Name Type Description
areaIndex number Area cost.
areaCost number New cost for the specified area index.

Usage⚓︎

---@type NavMeshAgent
local navmeshagent;

---@type number
local areaIndex;

---@type number
local areaCost;


navmeshagent.SetAreaCost(areaIndex, areaCost)

Extra Detail⚓︎

If you enable or disable the agent then the cost will be reset to the default layer cost.