Hello,
I'm running into an issue upon reloading a scene, but the dialogue system continues running the current conversation. There are events the player can trigger that will cause the scene to reload even if they're in the middle of a conversation, and this causes issues in the scene reload because the Dialogue Manager is never destroyed/reloaded so it just tries to finish out the conversation.
I was wondering how I can end all current conversations mid-flow, so I do that before calling the reload. It might be worth mentioning that I have it set up so there might be multiple parallel conversations happening at once.
Thanks in advance!
How to end all current conversations?
Re: How to end all current conversations?
Hi,
You can close the conversation controllers in the DialogueManager's activeConversations list. Loop down from the end because they'll remove themselves from the list as they close.
You can close the conversation controllers in the DialogueManager's activeConversations list. Loop down from the end because they'll remove themselves from the list as they close.
Code: Select all
public void StopAllConversations()
{
for (int i = DialogueManager.instance.activeConversations.Count - 1; i >= 0; i--)
{
DialogueManager.instance.activeConversations[i].conversationController.Close();
}
}
Re: How to end all current conversations?
Brilliant! Thanks
Re: How to end all current conversations?
Happy to help! I'll wrap up that code in a new DialogueManager.StopAllConversations() method in version 2.2.25.
Re: How to end all current conversations?
Hi Tony,
Sorry to resurrect this thread. I have a quick follow up question. How should I go about stopping a specific conversation.
The context again, is that there might be multiple conversations running at once (background texting conversations), and the a primary phone-call conversation that can be ended at any given point if the player hangs up the phone.
Is there a way to perhaps record which Dialogue Instance a given conversation is when I start that conversation, so I know which one to stop later on?
Sorry to resurrect this thread. I have a quick follow up question. How should I go about stopping a specific conversation.
The context again, is that there might be multiple conversations running at once (background texting conversations), and the a primary phone-call conversation that can be ended at any given point if the player hangs up the phone.
Is there a way to perhaps record which Dialogue Instance a given conversation is when I start that conversation, so I know which one to stop later on?
Re: How to end all current conversations?
After you call DialogueManager.StartConversation(), DialogueManager.instance.Conversation will be a reference to that conversatios. DialogueManager.instance.]activeConversations will contain a list of all active conversations. These are ActiveConversationRecords.
Let's say you've recorded the value of DialogueManager.instance.activeConversation after starting a conversation into a variable "myConversationRecord". You can stop that conversation by closing its controller:
Side note: You can get an active conversation's ID like this example:
Let's say you've recorded the value of DialogueManager.instance.activeConversation after starting a conversation into a variable "myConversationRecord". You can stop that conversation by closing its controller:
Code: Select all
myConversationRecord.conversationController.Close();
Code: Select all
ConversationModel model = DialogueManager.instance.activeConversation.conversationModel;
int ID = model.GetConversationID(model.firstState);
Re: How to end all current conversations?
Awesome! I think I understand the system, and I have it up and running nicely