Page 1 of 1
Conversation Selection Drop Down
Posted: Thu Jun 25, 2020 2:52 pm
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.
Re: Conversation Selection Drop Down
Posted: Thu Jun 25, 2020 2:58 pm
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;
Re: Conversation Selection Drop Down
Posted: Thu Jun 25, 2020 3:01 pm
by VoodooDetective
Oh fantastic! Yeah for me it doesn't show a dropdown. Cool, I'm excited to use this!
Re: Conversation Selection Drop Down
Posted: Thu Jun 25, 2020 3:12 pm
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.
Re: Conversation Selection Drop Down
Posted: Fri Jul 10, 2020 11:09 pm
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.
Re: Conversation Selection Drop Down
Posted: Fri Jul 10, 2020 11:27 pm
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);
Re: Conversation Selection Drop Down
Posted: Fri Jul 10, 2020 11:33 pm
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.
Re: Conversation Selection Drop Down
Posted: Sat Jul 11, 2020 7:14 am
by Tony Li
You could always cache the conversations into a dictionary or something at start.