Page 1 of 1

Fade old subtitiles

Posted: Fri Feb 17, 2023 4:13 pm
by Volandpro
Hello!
I am using TemplatedConversationLogUI from your example of how to do scrollable dialog UI in order to scroll through old messages. Is it possible to make old messages have their own color (for NPC and PC) and last message (not considering responses)- it's own?

Re: Fade old subtitiles

Posted: Fri Feb 17, 2023 5:24 pm
by Tony Li
Hi,

The old TemplatedConversationLogUI has been pretty much replaced by the SMSDialogueUI that's included in the Dialogue System itself. They both work the same way if I recall correctly. You can make a subclass of SMSDialogueUI and override the AddMessage() method to change the color of the previous message when adding a new message. For example, it might look something like:

Code: Select all

public class MyDialogueUI : SMSDialogueUI
{
    protected override void AddMessage(Subtitle subtitle)
    {
        if (instantiatedMessages.Count > 0)
        {
            // Change the background color of the previous message to gray:
            instantiatedMessages[instantiatedMessage.Count - 1].GetComponentInChildren<Image>().color = Color.gray;
        }
        
        // Then add the new message:
        base.AddMessage(subtitle);
    }
}