I am manually updating a grid graph when objects in my level are moved or destroyed. I set it so one of 3 states.
Clear - Penalty = 1 , walkable = true.
Wall - Penalty = wallPenalty , walkable = true
Blocked , Penalty = 0 , walkable = false
However at the moment I only seem to be able to add and remove penalties to an area, If there a way for me to just set the penalty?
currently I have tried doing this to clear a node to 1, however if there are nodes within the range that dont match the nearest this will obviously introduce bugs
NNInfo nearest = AstarPath.active.GetNearest(transform.position);
if( nearest.node.penalty > 1 )
{
m_PathDataDirty = true;
m_AIGraphUpdateObject.addPenalty = -(int)(nearest.node.penalty-1);
}