Page 1 of 1

Is there no hooks for something like OnConversationResponse?

Posted: Tue Feb 09, 2021 6:23 pm
by skullthug
Hi there, I'm trying to do a little visual sequence here with grabbing the strings as they come in from the Dialogue system via OnConversationLine, and putting them on the screen in a texture (basically an arty glorified chat log).
The ConversationLogger was the first place I looked for getting C# hooks to do this, but I'm realizing there's nothing that passes on any of the text used in dialogue response choices present in the ConversationLogger example- there's just a thing that gets called if the response menu is pulled up but not what is chosen from it. Does this ability exist?

Re: Is there no hooks for something like OnConversationResponse?

Posted: Tue Feb 09, 2021 8:13 pm
by Tony Li
Hi,

The Dialogue System will call OnConversationLine on the response entry's text when it processes the response, even if the line won't be shown onscreen as a subtitle (i.e., Dialogue Manager's Subtitle Settings > Show PC Subtitles During Line is unticked).

If you instead want to grab the response button text as soon as it's clicked but before it's actually processed and sent to OnConversationLine, you can make a subclass of StandardUIResponseButton and override the OnClick() method:

Code: Select all

public class MyCustomResponseButton : StandardUIResponseButton
{
    public override void OnClick()
    {
        Debug.Log(response.formattedText.text); //<-- Custom code added here.
        base.OnClick();
    }
}
Then use your subclass in place of StandardUIResponseButton

Re: Is there no hooks for something like OnConversationResponse?

Posted: Tue Feb 09, 2021 8:44 pm
by skullthug
Thanks. So OnConversationLine is what I would expect to work, except it's not reporting any of the response dialogue text at all for me (testing via both my implementation and ConversationLogger.cs)
[I'm using 2.2.12 which I'm assuming is probably fairly old now, so that might be relevant]

I'll see if I can at least get the StandardUIResponseButton method to work.

Re: Is there no hooks for something like OnConversationResponse?

Posted: Tue Feb 09, 2021 9:42 pm
by Tony Li
Hi,

That hasn't changed since the beginning of the Dialogue System.

As a test, I added a ConversationLogger to DemoScene1's Dialogue Manager and played the scene. Player responses get logged by ConversationLogger.OnConversationLine.