in my game i have a sprite that has animations the problem is that the polygon collider i have doesnt change when the sprite changes, from reading about i realized that id have to destroy and recreate the collider when sprite changes but im not 100% sure how id implement this, this is what i currently have
void Update ()
{
Destroy(gameObject.GetComponent<PolygonCollider2D>());
gameObject.AddComponent<PolygonCollider2D>();
}
i need to some how get this to update when the sprite in the renderer changes, currently i have it where it changes every update but this is not very smooth and messes with my collisions