Override penalty when updating graphs

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);

Easiest way is to create a small simple custom GraphUpdateObject.
Something like this:
public class MyGUO : GraphUpdateObject { public int setPenalty = 0; public override void Apply (Node node) { base.Apply(node); node.penalty = setPenalty; } }
And use that instead of the normal GraphUpdateObject.

Thanks that’s exactly what I was after,