[SOLVED] Double boxcollider2Ds don't work with animation

,

I have two boxcollider2Ds on my player object. When I go into recording mode in the animation window and try to change the size of the second one (the one without an “edit collider button”), the change isn’t recorded. It looks like it is, the collider changes and new keyframes for its changes look like they’re added, but they aren’t saved and when I turn preview mode on and off or switch to a different animation and come back none of the changes are there. This applies to changing the other properties of the collider too, not just the shape. This only happens on the bottom collider, the first one works perfectly fine. Is there a way to record changes on a second boxcollider2D in an animation? And if not, are there any other collider shapes that I can work similarly? I’ve tried a polygoncollider2D and it has the same problem (this isn’t a problem with every collider shape, a circle worked fine but it’s the wrong shape for my player).

1 Like

You are indeed correct, there is such an issue. I tested it myself and encountered the same result. However, I do have collider editing icons on all components. But the animation is only recorded for the first (top) collider. Moreover, this issue is not only with the Box Collider, as the same problem occurs with the Circle Collider.
I suspect that the animator relies only on the name (or type) of the component, and therefore it saves information only for the first one it finds.
And it’s even logical, because an animation clip can be added to another object, and the animation will work if that object has a certain type of component.

The first thing that comes to mind is to create a dummy child object with the required collider. Then the animator will correctly set the keys, as each object will have different names.

2 Likes

Made a dummy object, works perfectly! Thanks!