Quick answer: After changing obstacle costs at runtime, call Regenerate Obstacle Map. Path requests sent before regen use the stale grid — queue the regen first, then Find Path.
AI should avoid hazard tiles via raised pathfinding cost. The costs were added but AI still walks through them — the obstacle map was never regenerated.
The Map Is Cached
Pathfinding behavior bakes the cell grid (free / obstacle / cost) on layout start. Changing costs at runtime updates the data but not the cache. Regenerate to rebuild.
Regen Then Path
Add obstacle cost 50 to region around hazard
Pathfinding → Regenerate obstacle map
Pathfinding → Find path
The Find Path now sees the cost.
Cell Size Matters
Pathfinding cell size is set on the behavior. Costs apply per cell. If your hazard is smaller than one cell, raising cost has no effect — either lower the cell size or grow the cost region.
Path Smoothing Can Cut Corners
Path smoothing can shortcut across high-cost cells if the corner cells are cheap. Disable smoothing for safety-critical pathing, or expand the cost region.
Verifying
Place hazards, raise their cost, regenerate. AI paths route around hazards. Removing the cost + regenerating lets them path through again.
“Pathfinding works off a cached grid. Regenerate after every cost or obstacle change.”
Batch all cost changes for a frame and regenerate once at the end — one regen is much cheaper than N.