Conversation Selection Drop Down

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Conversation Selection Drop Down

Post by VoodooDetective »

Hey I was just wondering if there's an easy way to add one of those conversation selection drop downs to my own components. I currently enter the conversation name by hand, and I just realized it might be better to select from a drop down.

I'm guessing not since Dialogue System Trigger has you entering the string too, but figured I should ask.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation Selection Drop Down

Post by Tony Li »

What do you mean that the Dialogue System Trigger has you enter the string? Don't you see a dropdown?

In your own scripts, use the [ConversationPopup] attribute:

Code: Select all

[ConversationPopup] public string conversation;
Or, if you want to be able to specify a dialogue database:

Code: Select all

[ConversationPopup(true)]
public string conversation;
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Conversation Selection Drop Down

Post by VoodooDetective »

Oh fantastic! Yeah for me it doesn't show a dropdown. Cool, I'm excited to use this!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation Selection Drop Down

Post by Tony Li »

If it can't find a dialogue database in the scene -- either from the Dialogue Manager's Initial Database or a database assigned to the Dialogue System Trigger itself -- it will show a text input field.

The same applies to the [ConversationPopup(true)] attribute.
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Conversation Selection Drop Down

Post by VoodooDetective »

I was just wondering, is it possible to start a conversation by ID? I'd like to be able to use this dropdown and then rename a conversation without breaking the link.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation Selection Drop Down

Post by Tony Li »

The built-in components such as Dialogue System Trigger go by title, but your own code can start a conversation by ID. Example:

Code: Select all

int ID = 42;
var conversation = DialogueManager.masterDatabase.GetConversation(ID);
DialogueManager.StartConversation(conversation.Title);
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Conversation Selection Drop Down

Post by VoodooDetective »

Ah gotcha, thanks! I actually just found that method. Looking at the code, I don't see a cache for ID -> conversation. Is the Find method just as fast when it's comparing ints? Do you think I'm safe using that to start every conversation? I guess that obviously depends on the number of conversations. Ignore me.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation Selection Drop Down

Post by Tony Li »

You could always cache the conversations into a dictionary or something at start.
Post Reply