Page 1 of 1

2D On Use Trigger Help

Posted: Sat Jan 17, 2015 9:01 am
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?

2D On Use Trigger Help

Posted: Sat Jan 17, 2015 9:27 am
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.

2D On Use Trigger Help

Posted: Sat Jan 17, 2015 9:48 am
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?

2D On Use Trigger Help

Posted: Sat Jan 17, 2015 10:33 am
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".

2D On Use Trigger Help

Posted: Sat Jan 17, 2015 10:53 am
by midgear
Thank you that did it!

2D On Use Trigger Help

Posted: Sat Jan 17, 2015 11:47 am
by Tony Li
Happy to help! :-)