- Home /
How can I change a polygon collider in a Animation?
I tried clicking the "record" button, but the changes I made applied to all animations. A box collider that I changed work tho. Those colliders are childs of the game object that has the animation if that matters. Anyone knows what can be happening so the changes are being applied to all animations?
Answer by jrpimentel · Jan 03 at 03:23 AM
@Galse22 This is quite a bit late, but unfortunately the Polygon collider's information about its points on the polygon is stated in the documentation to be non-editable once set, so the animator isn't able to change it. Not sure why this is the case for this particular collider, but I'm sure it has to do with performance issues or something else complicated under the hood.
Listed in the table cell about Points: https://docs.unity3d.com/Manual/class-PolygonCollider2D.html
I'm not sure what your use case is, but it sounds like you might be trying to more perfectly match a sprite's animation during an attack to detect collisions? There might be a better way to do it to have it match more exact that I don't know about, but I've always settled on just using a box collider and try to match it the best you can to the attack/weapon/whatever's motion during the animation, usually giving the benefit of the doubt/extra space to the player when it can't be too precise.
Your answer
Follow this Question
Related Questions
Why doesn't my hexagonal collision fit properly? 1 Answer
2D platformer composite collider animation bug 2 Answers
Help! Enabling/Disabling colliders during animation doesn't work! 1 Answer
Unity is considering the colision even when the box collider 2D component is disabled 0 Answers
Root Motion vs Collider issue. How to stop animation moving char through a collider? 1 Answer