2D On Use Trigger Help

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
midgear
Posts: 15
Joined: Sat Jan 17, 2015 1:50 pm

2D On Use Trigger Help

Post by midgear »

So I'm making a 2D game that is using the dialogue system.



I can't get the conversation to start when the "On Use" trigger is selected. I can get the conversation to start if I us the "On trigger enter", "on start", and "on enable"



I can't figure out what I'm doing wrong. Can anyone help?
User avatar
Tony Li
Posts: 20991
Joined: Thu Jul 18, 2013 1:27 pm

2D On Use Trigger Help

Post by Tony Li »

Hi,



It's good to know that it works with "On Trigger Enter", "On Start", and "On Enable". This means the rest of the Conversation Trigger is set up right. So we just need to look at the trigger-firing part.



The "On Use" trigger fires when the GameObject receives an "OnUse" message.



How are you sending an "OnUse" message to the GameObject that has the Conversation Trigger?



The Selector and ProximitySelector components are 3D-only because they use Physics, which is the 3D PhysX library. If you're using one of these, you could make a copy and modify it to use Physics2D instead. (If this is what you want to do, let me know and I'll post a 2D-compatible version here.)



Whatever method you use to send the "OnUse" message, ultimately it should do something like this:

target.SendMessage("OnUse", this.transform);

to send "OnUse" to the target that has the Conversation Trigger component.
midgear
Posts: 15
Joined: Sat Jan 17, 2015 1:50 pm

2D On Use Trigger Help

Post by midgear »

Right now I'm just using the Some "2D Colliders", "RigidBody 2D", and some basic 2D character controllers and your "Selector" Script.



Would I need to add the Code you posted to my controller?
User avatar
Tony Li
Posts: 20991
Joined: Thu Jul 18, 2013 1:27 pm

2D On Use Trigger Help

Post by Tony Li »

Better yet, import this package. It contains an updated Selector that will be in v1.4.4. Inspect your Selector and change "Run Raycasts" to "In 2D".
midgear
Posts: 15
Joined: Sat Jan 17, 2015 1:50 pm

2D On Use Trigger Help

Post by midgear »

Thank you that did it!
User avatar
Tony Li
Posts: 20991
Joined: Thu Jul 18, 2013 1:27 pm

2D On Use Trigger Help

Post by Tony Li »

Happy to help! :-)
Post Reply