Unity 2D (trigger) box colliders not working on 5.3?

Hi! I just updated to Unity 5.3. I find the new features amazing.

I was building this 2D game for an event I’m going in 5 days. It was almost finished (code worked perfectly, I only had to import the animations), but now triggers are not working!

There’s a wave following the player. If it touches you, you die. That simple.

I attached a script with this code in it:

void OnTriggerEnter2D(Collider2D col)
        print("Are you even colliding my friend?");
        if (col.gameObject.tag == "Player")
            //Do stuff

As you see, I added the “print” lines to test if it was colliding (tried changing them to Debug.Log just in case “print” was not working anymore for some reason, but it’s the same), but they’re not showing at all.

Is this a Unity bug?


I realised it works if I move. It only fails if I just wait for the wave to touch me.
Still think it’s a Unity problem as that’s the way I always tested the wave.

I personally haven’t encountered this. Here’s a few debugging steps to help figure out the problem.

First off, try increasing the size of the collider2D on the wave. Depending on how it’s moving, and how small the collider2D is, it could be skipping over the player. Perhaps the player moving prevents this from happening?

Secondly, try using the same script on the player and checking for the wave. If this works, stop the wave from moving and move the player towards the wave. If this works, move the player via script towards the wave. This should emulate the problem but in reverse. This should help narrow down problem. Things to think about while testing: How movement is handled and collider sizes.

Also, I recommend moving the wave via a rigidbody2D if you are not. Translation causes a lot of issues with things like this due to how translation functions.

If none of this works, I’d be more likely to believe it is a Unity bug. I’ve encountered only a few Unity bugs during my time using it, they do happen. However, it’s more likely you are not using the engine properly and this creates a bug.

Let me know how your testing goes!

PS: Just to make sure I touch every point I can think of… Depending on how your player heirarchy is handled, does the base player object have a 2DCollider with the tag player? Do all child objects have this tag (if they have collider2Ds)? Does not having moved create an issue with instantiation of children objects and tags? These are kind of out there, and would (in most cases) be a weird way to handle your player. Just want to be thorough!


Same issue here. I posted the same yesterday but for some reason my post is under moderation.

I have two different games working on previous versions, some of them released, and after de upgrade all my trigger based games stopped working it is a very bad Unity bug.
It´s a shame. Since Unity 5.X we spent more time figuring out if game problems came from our code and then the most of times are Unity bugs o code mistakes. Even more if you are creating 2D. And in most cases all are Unity bugs.

As this took too long to be approved, I posted in the forums. It turned out to be both: a Unity 5.3 bug and a mistake I made. It should have never worked in the first place, as they told me, because I was moving a static collider (a gameobject without a Rigidbody), but there was a bug there too. I reported it and now it’s fixed!