Return All Active Buttons During Dialogue

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
baxta86
Posts: 17
Joined: Wed Jun 30, 2021 7:53 am

Return All Active Buttons During Dialogue

Post by baxta86 »

Hi Tony,

Just wondering if you have an easy way to return all the response buttons which appear during a conversation?

Eg: A conversation starts with one response button for the user (so I would like to return that one button/button name), but the next response in the conversation gives the player two response buttons to select from. How would I be able to return the choice of buttons/button names via code?

I know how to find the current selected button via EventSystem + UnityEngine.UI - but would be nice to be able to return the buttons dynamically as they appear in the conversation.

I'll keep trying to figure it out myself, but any help would be amazing.

Thanks mate
baxta86
Posts: 17
Joined: Wed Jun 30, 2021 7:53 am

Re: Return All Active Buttons During Dialogue

Post by baxta86 »

All good, found a way :)
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: Return All Active Buttons During Dialogue

Post by Tony Li »

[Edit: Our posts crossed. :-)]
Just before the Dialogue System shows a response menu, it calls the OnConversationResponseMenu(Response[]) method on any scripts that have that method, on the Dialogue Manager GameObject and the two primary participants' GameObjects (e.g., the Dialogue System Trigger's Conversation Actor and Conversation Conversant). Example:

Code: Select all

void OnConversationResponseMenu(Response[] responses)
{
    Debug.Log("About to show a response menu containing:");
    foreach (Response response in responses)
    {
        Debug.Log(response.formattedText.text);
    }
}
Post Reply