I'm afraid to say that the spine-unity runtime does not support updating collider shapes yet. It would anyway be a very bad idea to update the mesh of a PolygonCollider2D
at runtime with the animation. Unity has just introduced a new collider type CustomCollider2D
in Unity 2021.2+ which would allow updates of colliders at runtime with reasonable performance.
User @Jamez0r on the forum once started an implementation, as can be seen on this forum thread:
[Discussion] Mutable physics colliders in Unity 2021.2
Unfortuantely the thread ends without any results or insights being published yet.
In your case we would however strongly recommend to not use a single polygon collider at all, since that's a very computation-heavy solution for the physics engine. Instead it would be much better performance wise to use multiple box colliders. You then typically use BoneFollower
components to let them follow the respective bones and adjust the bounding box shape in Unity. Also be aware that gameplay-wise, you will rarely want the collision shapes to exactly match the character for the best user experience. In e.g. beat-em-up games the hit-boxes are typically larger than the character to provide the best game-feel, as can be seen in this forum posting by Nate:
Spine - libGDX collision detection