Emphasis TMP Color Gradient

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
spidercrab
Posts: 1
Joined: Tue Feb 07, 2023 4:33 pm

Emphasis TMP Color Gradient

Post by spidercrab »

Hello,
I would like to use the emphasis tags to change the colors of my response options (for example gold for main story line, red for special events). The colors I would like to achieve are using the TMP color gradients. What would be the easiest way to achieve this?

Thank you very much in advance :)
User avatar
Tony Li
Posts: 22137
Joined: Thu Jul 18, 2013 1:27 pm

Re: Emphasis TMP Color Gradient

Post by Tony Li »

Hi,

Emphasis tags don't support color gradients. Instead, apply TMP tags. You can process them in an OnConversationResponseMenu(Response[]) method in a script on the Dialogue Manager. Rough example:

Code: Select all

void OnConversationResponseMenu(Response[] responses)
{
    foreach (var response in responses)
    {
        if (response.formattedText.text.StartsWith("[gold]")
        {
            response.formattedText.text = response.formattedText.text.Substring("[gold]".Length); // remove the custom tag
            response.formattedText.text = $"<gradient="Gold">{response.formattedText.text}</color>";
        }
    }
}
Post Reply