Cannot get get GraphUpdateObject to set penalties

I have several objects in the scene. They have the following code in Start():

    GUO = new GraphUpdateObject(MyCollider.bounds);
    GUO.addPenalty = 10000;
    //GUO.modifyWalkability = true;
    //GUO.setWalkability = false;
    AstarPath.active.UpdateGraphs(GUO);

It does not set the penalties, paths go right through the objects. If I uncomment the lines about walkability, that works fine. This is straight out of the documentation. What could be wrong?

Check if it shows up when you use the A* Inspector -> Settings -> Debug Mode = “Penalty” (and adjust the gradient max value to be 10000).

A penalty of 10000 is roughly equivalent to the cost of moving 10 world units, so you might want to increase it.

Also, try to set
GUO.updatePhysics = false;

That might be something I forgot to add in the documentation… Though I think it should work even with it enabled.

Okay, I got it working. These objects that interrupt the pathing move slowly, so I need to restore the normal penalties once they have moved off of some nodes. This is my approach - I have a GUOAdd that adds 100000, and a GUOReset adds -100000.

I keep a copy of the previous bounds, and apply them like this when the object has moved sufficiently:

 GUOReset.bounds = _previoiusBounds;
 AstarPath.active.UpdateGraphs(GUOReset);

 GUOAdd.bounds = MyCollider.bounds;
 AstarPath.active.UpdateGraphs(GUOAdd);

 _previousBounds = MyCollider.bounds;

This works for a short while, then I get this error:

"Very high penalty applied. Are you sure negative values haven't underflowed?"

and Unity hangs. Is there any way I can accomplish this safely?

Most likely you have applied the negative penalty multiple times on some nodes (or added the positive penalty more than 20000 times, but that is unlikely).
Set Debug Mode = Penalties in A* Inspector -> Settings and enable Show Graphs. That will color nodes depending on what penalty they have, make sure it works correctly.

Also, make sure you set GUO.updatePhysics=false for this because when updatePhysics is enabled, it will first recalculate all parameters on those nodes (which among other things, sets the penalty to the default value).

Okay, thanks!