Page 1 of 1

Emphasis TMP Color Gradient

Posted: Tue Feb 07, 2023 4:48 pm
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 :)

Re: Emphasis TMP Color Gradient

Posted: Tue Feb 07, 2023 5:59 pm
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>";
        }
    }
}