OnTriggerEnter not called when two objects in canvas collide

Hey!

I attached "Box Colliders 2D" to two panel objects which are in the same Canvas object.
I did that many times before outside of Canvas objects and it always worked, but it seems it won’t work inside Canvas object.

I want to know when panels collide, and when they do - take action.
Currently I have this code at one of them:

    void OnTriggerEnter2D(Collider2D other){
        switch(other.name){
        case "bottomBorder":
            Debug.Log ("OUT OF SCREEN");
            break;
        }
    }

Both Box Collider 2D Components have “IsTrigger” option ON.
Bounds of colliders are exactly at the visible bounds of panels.

And when they collide, OnTriggerEnter2D is not firing up… Why? :frowning:

Try to add a kinematic Rigidbody2D to one of the objects, worked for me (5.5)

1 Like