[Solved] OnCollsionEnter2D() works but OnTriggerEnter2D() does not

Observed Behavior
In Lecture 72, while creating the script for collisions and triggers they are both supposed to print to the console. When the check box for IsTrigger is unchecked on the LoseCollider the ball stops on of the collider and Collision prints to the console. When the IsTrigger is checked on the loseCollider the ball passes through the Collider and nothing prints.

Expected Behavior:
The ball should pass through the LooseColider and then Trigger should print to the console.

What I’ve tried:
I’ve Triple checked my script and been through various relevant parts of the video to check my settings. I’ve tried checking and unchecking the IsTrigger box on the collider on the ball and still get the same results.

Here’s my Code

Here are the settings for LooseCollider

Here are the settings for the ball:

@darthhiggy There is a typo in your code on line 6. It should be OnTriggerEnter2D() instead of OnTriggerEnter2d()

1 Like

@Cozinater thanks that fixed the issue

Privacy & Terms