Edge Collider Issue v 2

As previous student mentioned I also had the issue where the edge collider only formed a horizontal line through the sprite.
Seems to be a bug in the collider, but I fixed it by clicking the “Edit Spline” button on the Sprite Shape Controller twice (enable / disable) and the collider positioned itself nicely just outside the outer edge of the sprite.

23 Likes

This is by design. i.e. how it works in the course is not how it should work. The edge collider is designed to be added as a green line and then you conform it to something in your scene by adding points and lining it up yourself. Because I got tired of not being able to do the lessons as instructed and since none of the “solutions” promoted here worked for me, I checked with Unity via bug report. They stated this is how it’s supposed to work and they will update the Unity docs to reflect it. If you want automatic conformity to your shape you should instead use the polygon collider and not the edge collider.

Hi,

Thanks for submitting the issue.

Edge Collider 2D is a bit different than other 2D Colliders. The Collider’s shape is a freeform edge that can be adjusted to fit and surround any shape needed (e.g. it’s perfect for creating a Collider for terrain). By design, a freshly added Edge Collider 2D is just a straight line with two points but you can add more points and move them to preferred positions by using the Inspector (I have attached a screenshot of the exact position in the Component for this) or after selecting “Edit Collider” and adding points directly to the Collider using your mouse.

Edge Colliders can’t detect collisions between themselves. That is due to the collision algorithms that require at least one of the colliding shapes to have volume. Edge Colliders do not have that. If you change the Collider type on one of the objects - collision is detected. It does appear that this specific information is missing from the Documentation page, so I have requested to update it to avoid any further confusion.

If you want to find out more on Edge Collider 2D, I suggest checking out Unity’s Documentation:
Unity - Manual: Edge Collider 2D

That said, if you have further questions, please feel free to contact us.

Thanks,
Saulė
Customer QA Team

3 Likes

Hey guys,

Unsure if this is helpful for either of you, but here’s hoping this is helpful for others in the future.

The EdgeCollider2D appears to have inconsistent results when applied to Sprite Shapes. I also encountered an issue where it was simply a line when I added it as a component; however, after restarting Unity the EdgeCollider2D appears to have wrapped my Sprite Shape.

For anyone who is curious, I’m currently working on Windows 10, Unity version 2020.3.25f1.

2 Likes

I was able to automatically populate the EdgeCollider2D points by clicking Save Scene.

17 Likes

This is the way. Thank you.

Thank you so much!

Thanks! Works for me on Mac too! <3

Thanks!

Holy moly. Who would’ve thought that saving your file would fix this bug…thank you! (FWIW I’m on a Mac and this worked perfectly)

thank you ^^

Privacy & Terms