Is there no hooks for something like OnConversationResponse?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
skullthug
Posts: 8
Joined: Sat Nov 16, 2019 9:52 pm

Is there no hooks for something like OnConversationResponse?

Post 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?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Is there no hooks for something like OnConversationResponse?

Post 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
skullthug
Posts: 8
Joined: Sat Nov 16, 2019 9:52 pm

Re: Is there no hooks for something like OnConversationResponse?

Post 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.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Is there no hooks for something like OnConversationResponse?

Post 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.
Post Reply