Show dialog entry on 2D object touch/click

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Ekta Bhutwala
Posts: 40
Joined: Mon Sep 05, 2022 5:40 am

Show dialog entry on 2D object touch/click

Post by Ekta Bhutwala »

Hii..

I have made conversation dialog tree in which dialog entry suppose like this :

1) Hello1
2) Hello2
3) Let me knock at the door
4) Yes, How can i help you?

This conversation starts when scene loads. now when i click continue then 2) Hello2 will be displayed. then again click continue then 3) let me knock at the door will be displayed.

Now when i click on door then only 4) Yes, How can i help you? should be displayed. Not on continue button or automatically.

Thanks.
User avatar
Tony Li
Posts: 21973
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show dialog entry on 2D object touch/click

Post by Tony Li »

Set (3)'s Sequence to:

Code: Select all

SetContinueMode(false);
WaitForMessage(ClickedDoor)
Set (4)'s Sequence to:

Code: Select all

SetContinueMode(true)
Configure the door to send the sequence message "ClickedDoor". If the door has a collider, you could do it in a script with an OnMouseUp() method, such as:

SequencerMessageOnMouseUp.cs

Code: Select all

using UnityEngine;
public class SequencerMessageOnMouseUp : MonoBehaviour
{
    public string message = "ClickedDoor";
    
    void OnMouseUp()
    {
        PixelCrushers.DialogueSystem.Sequencer.Message(message);
    }
}
More info:
Ekta Bhutwala
Posts: 40
Joined: Mon Sep 05, 2022 5:40 am

Re: Show dialog entry on 2D object touch/click

Post by Ekta Bhutwala »

Hii Tony,

Eventhough i have added

Code: Select all

SetContinueMode(false);
WaitForMessage(ClickedDoor)
to sequence part of Line 3 node it's working on continue button click where as i want only on door click.

I make set up on door collider also which is working but how to prevent it from UI continue button?

Image
Attachments
Screenshot 2022-09-06 190043.png
Screenshot 2022-09-06 190043.png (37.24 KiB) Viewed 297 times
User avatar
Tony Li
Posts: 21973
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show dialog entry on 2D object touch/click

Post by Tony Li »

Hi,

That Sequence looks correct. Are you editing the correct dialogue database asset? Make sure you're not accidentally editing the auto-backup asset. Also check that the correct dialogue database is assigned to the Dialogue Manager's Initial Database property.

If that looks correct, are there any errors or warnings in the Console window?
Ekta Bhutwala
Posts: 40
Joined: Mon Sep 05, 2022 5:40 am

Re: Show dialog entry on 2D object touch/click

Post by Ekta Bhutwala »

Hii Tony,

There is no error , no warning in log. and i am making changes in right conversation. i checked 2 times.

Is there any other way i can do same?
User avatar
Tony Li
Posts: 21973
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show dialog entry on 2D object touch/click

Post by Tony Li »

Yes; use a scene event.
Ekta Bhutwala
Posts: 40
Joined: Mon Sep 05, 2022 5:40 am

Re: Show dialog entry on 2D object touch/click

Post by Ekta Bhutwala »

My problem is next dialog entry(4) Yes, How can i help you?) should be displayed only on door object click not on continue button click.

In my case using above code, it's working on continue button click also.
how can i stop using continue button just for 4th number dialog entry?

I am using this code :

Code: Select all

 SetContinueMode(false)
It should work for not allowing action on continue button. but i don't understand why it is allowing.
User avatar
Tony Li
Posts: 21973
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show dialog entry on 2D object touch/click

Post by Tony Li »

Post Reply