Use StopConversation to stop a specific conversation
Posted: Wed Aug 24, 2022 12:37 pm
Hello,
My project often involves situations where I have two or even three conversation UIs open at the same time. I would like to have a sort of "close" button attached to the two secondary conversation UI windows so that the player can cancel them at any time.
I thought I could achieve this by having the button call DialogueManager.StopConversation(), but I notice that this method doesn't accept arguments and I can't work out another way to specify which conversation to stop. (I'm not sure if this is 100% scientific but I think it might stop the conversation whose UI is highest in the hierarchy??)
Anyway I'd prefer not do it by entering the conversation title as a string, as I'd rather have the button tied to the UI than the conversation. However it's important that the button does stop the conversation rather than just (for example) disabling the UI, because otherwise there are compounding problems when trying to start conversations again.
My C# is poor so I'm not sure how to script this correctly, but I wonder if there would be a way to perform something like:
My project often involves situations where I have two or even three conversation UIs open at the same time. I would like to have a sort of "close" button attached to the two secondary conversation UI windows so that the player can cancel them at any time.
I thought I could achieve this by having the button call DialogueManager.StopConversation(), but I notice that this method doesn't accept arguments and I can't work out another way to specify which conversation to stop. (I'm not sure if this is 100% scientific but I think it might stop the conversation whose UI is highest in the hierarchy??)
Anyway I'd prefer not do it by entering the conversation title as a string, as I'd rather have the button tied to the UI than the conversation. However it's important that the button does stop the conversation rather than just (for example) disabling the UI, because otherwise there are compounding problems when trying to start conversations again.
My C# is poor so I'm not sure how to script this correctly, but I wonder if there would be a way to perform something like:
Code: Select all
if(conversationIsActive in SMSDialogueUI)
{
DialogueManager.instance.StopConversation();
}