On Trigger Enter sometimes not working

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

On Trigger Enter sometimes not working

Post by GreenConure »

Hello again!

I'm currently running into this instance of conversations set to On Trigger Enter not working sometimes. I have 2D physics enabled and the game object includes a Box 2D collider, a DS trigger, with tags set to the player.

What's currently happening is that sometimes these conversations work, and sometimes they don't. When this happens, what usually solves it for me is to copy another existing On Trigger enter conversation and replace the conversation it starts. However, there is no difference in their setup or components. Would you have any idea as to what could be causing this?

Let me know if there's any other information I can give.
Thank you!
Error412
Posts: 23
Joined: Sat Feb 05, 2022 4:52 am

Re: On Trigger Enter sometimes not working

Post by Error412 »

Hi, is there is any chance that you could share a sample of your project, or a test scene reproducing this issue? Sometimes the collider area is too small by default on some objects but this doesn't seem your issue.
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: On Trigger Enter sometimes not working

Post by Tony Li »

You might need to add a Rigidbody2D component. You can set it to Kinematic to prevent it from being moved by physics forces.

If that doesn't fix it, check the GameObject's layer. If you've specified in the Edit > Project Settings > Physics 2D collision matrix that certain layers should register collisions, then make sure the GameObject is on a layer that registers collisions with the player's layer.
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

Re: On Trigger Enter sometimes not working

Post by GreenConure »

Hi! That worked well! Thank you so much again. :)
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: On Trigger Enter sometimes not working

Post by Tony Li »

Glad to help!
Post Reply