Fade old subtitiles

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Volandpro
Posts: 9
Joined: Sat Feb 04, 2023 3:28 am

Fade old subtitiles

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

Re: Fade old subtitiles

Post 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);
    }
}
Post Reply