Dialogue Actor Subtitle Color not working with SMS prefab

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
dantuom
Posts: 18
Joined: Fri May 06, 2022 10:06 am

Dialogue Actor Subtitle Color not working with SMS prefab

Post by dantuom »

I'm having a problem getting the Subtitle Color I apply in my NPC's Dialogue Actor component to display when using the SMS prefab.

My goal is to have a feeling of a group text thread where each participant is identified by a different font color. I added placeholder portrait sprites to test whether changes to the Dialogue Actor component were working in principle, but in the long run I'd like to identify NPCs by color alone.

I think I have everything hooked up ok, or at least it works with these settings when using the WRPG template.
Vrouwii GameObject.png
Vrouwii GameObject.png (150.04 KiB) Viewed 609 times
Dialogue Editor.png
Dialogue Editor.png (321.5 KiB) Viewed 609 times
Gameplay example.png
Gameplay example.png (334.13 KiB) Viewed 609 times
I tried fixing it by turning the alpha right down on the Text Color in the NPC Subtitle Text component, but this just made it disappear entirely. I even tried adding an Override Dialogue UI component to the NPC, but couldn't make that work either.

I then tried assigning a different NPC panel to an additional color, and while this kind of worked when editing, it still didn't display at runtime. (Anyway since the Dialogue Actor Subtitle Color is there it would be nice to use it, since it seems a more elegant and scaleable solution.)
Extra panels UI setup.png
Extra panels UI setup.png (77.86 KiB) Viewed 609 times
Extra panels NPC setup.png
Extra panels NPC setup.png (97.08 KiB) Viewed 609 times
Extra panels editor.png
Extra panels editor.png (346.17 KiB) Viewed 609 times
Extra panels runtime.png
Extra panels runtime.png (326.87 KiB) Viewed 609 times
Am I missing something obvious? Or is the SMS prefab only configured to work with one text color?

Thanks in advance!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue Actor Subtitle Color not working with SMS prefab

Post by Tony Li »

Hi,

In those SMS-style screenshots, it looks like the text is always white and the bubble colors vary by actor.

Is that the way you want it to work? If so, here's an example exported from Unity 2021:

DS_CustomSMSExample_2022-05-11.unitypackage

It looks like this:

customSMS.png
customSMS.png (8.05 KiB) Viewed 603 times

It uses the subclass of SMSDialogueUI below that supports additional subtitle panel templates. (See: Instructions on replacing scripts in-place.)

To add more subtitle panels, duplicate NPC Message Template, customize the Bubble color, and assign the duplicate to the Standard Dialogue UI component's Conversation UI Elements > Subtitle Panels list. Make a note of the panel's number (0, 1, 2, etc.). Then add a Dialogue Actor component to an NPC, and set its Dialogue UI Settings > Subtitle Panel Number to match.

CustomSMSDialogueUI.cs

Code: Select all

using PixelCrushers.DialogueSystem;
public class CustomSMSDialogueUI : SMSDialogueUI
{
    protected override StandardUISubtitlePanel GetTemplate(Subtitle subtitle)
    {
        var panelNumber = DialogueActor.GetSubtitlePanelNumber(subtitle.speakerInfo.transform);
        return (panelNumber == SubtitlePanelNumber.Default) 
            ? base.GetTemplate(subtitle)
            : conversationUIElements.subtitlePanels[PanelNumberUtility.GetSubtitlePanelIndex(panelNumber)];
    }
}
dantuom
Posts: 18
Joined: Fri May 06, 2022 10:06 am

Re: Dialogue Actor Subtitle Color not working with SMS prefab

Post by dantuom »

Tony Li wrote: Wed May 11, 2022 8:30 am
In those SMS-style screenshots, it looks like the text is always white and the bubble colors vary by actor.

Is that the way you want it to work?
No, the opposite is the problem. I'm trying to make the text colour itself vary for each NPC and haven't been able to do so at runtime, hence the screenshots showing white text.

However I think after banging my head against this mystery for a few hours I am prepared to give the differently coloured bubbles a try if that is easier to implement. It may even work better for readability in the long run.

I probably won't be at my unity workstation for the rest of the day but will try the solution you've proposed tomorrow. Thanks Tony!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue Actor Subtitle Color not working with SMS prefab

Post by Tony Li »

Got it. This updated SMSDialogueUI will let you override the text color using Dialogue Actors. The change will also be in version 2.2.28.

DS_SMSDialogueUIPatch_2022-05-11.unitypackage

It also supports multiple template subtitle panels, so if you decide to go with different bubbles you don't need to use the CustomSMSDialogueUI script above.
dantuom
Posts: 18
Joined: Fri May 06, 2022 10:06 am

Re: Dialogue Actor Subtitle Color not working with SMS prefab

Post by dantuom »

Yep, that works straight out of the box. Thanks!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue Actor Subtitle Color not working with SMS prefab

Post by Tony Li »

Glad to help!
Post Reply