using GeometryCollider.cs, how do I run Bake() from another script?

I have some sprite shape controllers, they are using variable Heights on the dynamically generated spline points.

I'd like a collider to cover the shape, there is no fill. It is a line shape.

Using Edge collider edge radius, doesn't account for variable heights.

I am using the script in sprite shape extras, called GeometryCollider.cs in conjunction with polygon collider 2d, as others have pointed out, update collider is a heavy process.

I only need to call Bake once, when my spline is changed. I am having trouble calling this function.

Route 1:
Access the static public function

SpriteShapeExtras.GeometryCollider.Bake(someGameObject, forcedBake);

result, nothing happens.


Waiting one frame after changing the sprite shape works:

void MySpriteShapeChange()
// do stuff

    IEnumerator PathExtraFrame()
        yield return null;
        SpriteShapeExtras.GeometryCollider.Bake(pathShape.gameObject, false);