Setting up a 2d Trigger for conversation OnUse

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Icolino7
Posts: 6
Joined: Wed Nov 27, 2019 9:47 am

Setting up a 2d Trigger for conversation OnUse

Post by Icolino7 »

Hi, I am having trouble setting up the 2D OnUse DialogSystemTrigger. I am in a Unity 2d project.

These are the steps that have been done, as i have found them on your youtube tutorial.

1. Dialogue System Trigger component set to OnUse.
2. Usable component whose Max Use Distance is high enough. (Set it to 99999 as a test.)
3. Rigidbody and collider. If you're using 2D, use a Rigidbody2D and 2D collider.
4. Make sure the physics layers are configured to detect each other. (Edit > Project Settings > Physics)

And even the physiscs2d is enabled.

If possible could you send me a demo of a 2d scene working with OnUse so I can compare to where I might have made a mistake.

Another question that I am interested in : is it possible to set the trigger on UI buttons/images for conversations. And what would be the recommended way.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting up a 2d Trigger for conversation OnUse

Post by Tony Li »

Hi,

Here's an example:

DS_2DTriggerExample_2019-11-27.unitypackage

There are 2 interactable objects:
  • Villager: Walk up to the villager and press the space bar to interact. Uses a Proximity Selector component and Dialogue System Trigger set to OnUse to start a conversation.
  • Barrel: Walk near it. Uses a Dialogue System Trigger set to OnTriggerEnter to show an alert message.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting up a 2d Trigger for conversation OnUse

Post by Tony Li »

Icolino7 wrote: Wed Nov 27, 2019 10:14 amAnother question that I am interested in : is it possible to set the trigger on UI buttons/images for conversations. And what would be the recommended way.
Sorry, I don't understand. Can you please post a mock-up image that describes what you want to do?
Icolino7
Posts: 6
Joined: Wed Nov 27, 2019 9:47 am

Re: Setting up a 2d Trigger for conversation OnUse

Post by Icolino7 »

Well, let's say you want to trigger a dialog/monologue when you click on a sprite or a UI button with a touch or a mouse.

Is that achievable? Cause I don't seem to be able to achieve it.

Example: You have a start button. Click it and it starts the intro tutorial monologue.



Btw, thank you for the demo. I did figure those parts out. 2D Collision triggers work fine. Well done.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting up a 2d Trigger for conversation OnUse

Post by Tony Li »

Hi,
Icolino7 wrote: Wed Nov 27, 2019 11:32 amWell, let's say you want to trigger a dialog/monologue when you click on a sprite or a UI button with a touch or a mouse.
Add a Dialogue System Trigger to the UI button, and leave its trigger dropdown set to OnUse. Then select Add Action > Start Conversation, and select the conversation you want to play.

Configure the UI button's OnClick() event to call the Dialogue System Trigger's OnUse() method.
Icolino7
Posts: 6
Joined: Wed Nov 27, 2019 9:47 am

Re: Setting up a 2d Trigger for conversation OnUse

Post by Icolino7 »

Tony Li wrote: Wed Nov 27, 2019 12:41 pm Hi,
Icolino7 wrote: Wed Nov 27, 2019 11:32 amWell, let's say you want to trigger a dialog/monologue when you click on a sprite or a UI button with a touch or a mouse.
Add a Dialogue System Trigger to the UI button, and leave its trigger dropdown set to OnUse. Then select Add Action > Start Conversation, and select the conversation you want to play.

Configure the UI button's OnClick() event to call the Dialogue System Trigger's OnUse() method.
Thank you I figured I would have to do it in that way. Anyway your product is sweet.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting up a 2d Trigger for conversation OnUse

Post by Tony Li »

Thanks! :-)
Post Reply