OnTriggerEnter2D Not firing at all.

Ive read dozens of posts like this one already posted yet I cant use those answers to fix this issue. I tried fiddling with giving the trigger a rigidbody but didnt work. Also already checked layers and they are set up properly.

I have falling balls as prefab that then a gameobject with a script spawns on the scene one after the other. When they reach the bottom theoretically they should pass through an edge collider marked as a trigger and a script which destroys the gameobject and throw a Debug.Log.

But nothing is happening. Not even the Debug.Log is showing up.

Code for the edge collider trigger and inspector screenshot:

public class Destroyer : MonoBehaviour {

    void OnTriggerOnTriggerEnter2D(Collider2D col) {

        Destroy(col.gameObject);

        Debug.Log("WORKS");
    }

}

And here is the inspector screenshot for each ball that is meant to be destroyed off-screen:


You have a typo in the name of your OnTrigger method. It should just bevoid OnTriggerEnter2D (Collider2D collider)

2 Likes

GODDAMIT

2 Likes

Great response. I did the same thing.