A very short note on Unity 2D and pixel characters

Just a note on a simple problem with Unity 2D and small sprites’ physics.


imageI could not get my 2 pixel by 2 activist demonstrating in the scene to collide with buildings when working in 2D. By using the 3D box collider and locking rotations everything worked fine, but it was not cool at all given the very flat design of People in Love.

I am using 2D Toolkit for handling sprites and atlases, and I was using its built-in 2D physics collider integration, letting it compute the perfectly fitting box collider. But I didn’t get (2D) collisions.

But then using Unity 4.5.2 I got this warning at runtime: “The collider did not create a collision shape…”


Turns out this is the problem:

Box Collider 2D does not collide when its size is small (like 0.01)

2 pixel wide activist


The solution is not hard: I simply set in 2D Toolkit to leave the colliders as user defined, and I added an Edge Collider 2D to the activist prefab. Works fine Sorriso

EDIT: Thanks to a suggestion from the ineffable Daniele Giardini I’m now using a Circle Collider 2D which works fine even at 0.003 radius and fits perfectly with my activists.

Now I am a Unity beginner dev so any suggestion on refining this would be very welcome – I’m here on Twitter.


Social Share Toolbar