- Home /
BoxCollider2D won't update size during Animation unless transform changes too.
Here's the issue abstracted:
I have a Player object with a Rigidbody, a BoxCollider2D and an Animator Attached to it. The animator has a default state called Idle and the only thing that animation does is change the player's BoxCollider2D size.
The boxcollider never changes its size when I run the project, I tested it by colliding it with another BoxCollider2D and it never resizes.
NOTE: If I do ANY change to the transform component of the player (like changing its position or its rotation), the BoxCollider2D resizes correctly both in the animation editor and in the game running.
This is definitely a bug. I found a workaround:
You don't have to make changes to the transform in the same animation for it to work correctly, you can just add any other animation that does a change in the transform object even if you don't use that animation ever, as long as its in there it'll fix it.