Textline Dialogue UI does not want to register an additional subtitle panel.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Stalker_EG
Posts: 31
Joined: Sun Jul 07, 2019 7:57 pm

Textline Dialogue UI does not want to register an additional subtitle panel.

Post by Stalker_EG »

Good afternoon. I already broke my whole head...
Textline Dialogue UI does not want to register an additional subtitle panel.

I have a dialogue between the Player and NPS.
Sometimes I need to insert subtitles from the author (He is defined in the database as a separate NPS, in the scene there is a GO with Dilogue Actror component with the panel number and color of subtitles).
when you play the dialog, the author's lines get into the standard NPS panel.

Where do I search?
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Textline Dialogue UI does not want to register an additional subtitle panel.

Post by Tony Li »

Hi,

Make a subclass of TextlineDialogueUI.cs. Use this subclass instead of TextlineDialogueUI. Override the GetTemplate method. The base method looks like this:

Code: Select all

protected virtual StandardUISubtitlePanel GetTemplate(Subtitle subtitle)
{
    return subtitle.speakerInfo.IsNPC ? conversationUIElements.defaultNPCSubtitlePanel : conversationUIElements.defaultPCSubtitlePanel;
}
If the subtitle's speaker is an NPC, it uses the default NPC panel. Otherwise it uses the default PC panel.

In your overridden method, you can get the speaker's desired panel instead:

Code: Select all

protected virtual StandardUISubtitlePanel GetTemplate(Subtitle subtitle)
{
    var ui = DialogueManager.dialogueUI as StandardDialogueUI;
    DialogueActor dialogueActor;
    var panel = ui.conversationUIElements.standardSubtitleControls.GetPanel(subtitle, out dialogueActor);
    if (dialogueActor != null) subtitle.formattedText.text = dialogueActor.AdjustSubtitleColor(subtitle);
    return panel;
}
(Note: You may need to update to version 2.2.5 to have access to the GetPanel() method.)
User avatar
Stalker_EG
Posts: 31
Joined: Sun Jul 07, 2019 7:57 pm

Re: Textline Dialogue UI does not want to register an additional subtitle panel.

Post by Stalker_EG »

Thank you. It works with the tag [panel=2].
but if you define this panel in the Dilogue Actror component, it does not work(
User avatar
Stalker_EG
Posts: 31
Joined: Sun Jul 07, 2019 7:57 pm

Re: Textline Dialogue UI does not want to register an additional subtitle panel.

Post by Stalker_EG »

It's working now! Thank you so much. The last problem was that there was a second NPS entry for the author in the attached database. I removed it and now everything is working.
User avatar
Stalker_EG
Posts: 31
Joined: Sun Jul 07, 2019 7:57 pm

Re: Textline Dialogue UI does not want to register an additional subtitle panel.

Post by Stalker_EG »

Everything works except the color and other subtitle settings of the Dilogue Actror component.
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Textline Dialogue UI does not want to register an additional subtitle panel.

Post by Tony Li »

You'll need to add a couple of lines to the script. I updated my previous post with the extra lines of code.
Post Reply