- Home /
Is there a way to animate the edge collider of my 2D character?
It is a 2D project in Unity 2018.4.8f1. I can animate box colliders 2D without any problems, but with an edge collider 2D I can't. If I try, the change is always applied to all frames of the sprite in every animation.
I use an Edge Collider 2D because the Box Collider 2D got stuck very often on the Tile Collider 2D of the Tilemap. (I also tried it with different materials. Apparently a bug.)
Answer by ejoo_pasco · Sep 16, 2019 at 03:06 PM
Hi Skeasy, looks like animation of EdgeCollider2D has some limits. In the Animation window there are offered the properties
Densitiy
Edge Radius
Enabled
Is Trigger
Used By Effector
Offset.
The Points you can see in the Inspector and Scene View are not editable from the Inspector hence not animatable. So if the given properties are not meeting your needs you need another solution.
E.g. - If that would solve your problem, you could make different colliders and switch them on and off. OR: place the Collider on a child gameobject, which you then can scale, rotate etc.
See in the description of EdgeCollider2D - Points are readonly: https://docs.unity3d.com/Manual/class-EdgeCollider2D.html
Yes, I think there are several ways around, but it's still a shame ... thank you anyway!
Your answer
Follow this Question
Related Questions
Unity 4.5.2 bug changing the properties of the 2d colliders in animation 1 Answer
4.5.2 animation BUG: 2D collider colliding with 2d trigger!!! 0 Answers
[2D graphical bug] Sprite Edge blends. Why this is happening? 1 Answer
Unity rotation bug??? or my mistake (with video) 1 Answer
Mesh collider without Rigidbodies 1 Answer