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("Trigger bounce" + 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 :
-
Putting all the element on the same Z position to be sure they’re triggering
-
Reproducing the most simple situation, which I made work in an other project, but not in this one
-
I checked that in my project settings > physics 2D the Y gravity was -9.81
-
I tried resizing the boxCollider2D size
-
Verified the script triggerBounce was launched by debug.log(“start”) in his start
And even tough I did all this, it doesn’t work any better
I wanted to put a pic to explain but the site doesn’t want me too, so I put the pic here :
https://www.notion.so/unity-trigger-not-triggering-issue-63989b934e634d9285af29098969a251