unity-game-enginetriggerscollider

Unity trigger not triggering


I'm having one of the most basic issue but I really can't get it work on my project. I even tried to re-create a blank project and create a similar situation, in this new project, the trigger is working well but not in my old one and I can't figure out why so I'm looking for help here.

Here is some explanation on what I have, first, the character :

 My character with : 
      Box Collider 2D with NOTHING check (so isTrigger, used by effector, etc, they are NOT checked) 
      Rigidbody 2D Dynamic, simulated, continuous and stat awake.

Then, the platform prefab :

 Platform prefab (BoxCollider2D with Used By Effector, Platform Effector 2D)
    Child of platform prefab > front part (just a sprite renderer)
    Child of platform prefab > triggerPart (Empty object scale 4,1,1 with BoxCollider2D with is Trigger checked and the script "triggerBounce"

Here is the script triggerBounce : (For now, I'm just trying to see if the trigger is working)

private void OnTriggerEnter2D(Collider2D collision) 
     {Debug.Log("triger in " + name + " " + collision.name);}
 
 private void OnTriggerStay2D(Collider2D collision)
     {Debug.Log("triger stay " + name + " " + collision.name);}
 
 private void OnTriggerExit2D(Collider2D collision)
     {Debug.Log("triger exit " + name + " " + collision.name);}

I searched a lot of help on the internet before posting this, like this :

And even tough I did all this, it doesn't work any better.

Here is a pic of the situation, it can help you understand the problem : enter image description here


Solution

  • Thanks to @Morion, I found what the problem was.

    All my GameObject had the "default" layer and the collision matrix wasn't checked for 2 default.

    So, I went to Edit > Project Settings > Physics 2D

    and check the box where the row and column was default.

    Collision matrix