is there a way to reset a box collider like the reset button in the inspector?

I need to fit a box collider to a TMP_Text after rescaling the TMP_Text.The calculations for the new sizes are complex and i’d rather not get into it, but if i pause the game after rescaling the TMP_Text, find the box collider in the inspector, right-click it and hit Reset, it scales perfectly. i just can’t find a way to do it with code.

Why not delete the old TMP component and add a new one?,Why not delete and add a new component?

I’m not sure if this would work, but you can try this:

void ResetCollider()
    collider = default(BoxCollider);