Can I change the color of the portrait name per actor?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Can I change the color of the portrait name per actor?

Post by AoF »

Just like the actor subtitles, I'd like to change the color of the portrait name depending on who's speaking. Is this possible?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Can I change the color of the portrait name per actor?

Post by Tony Li »

It would require a little scripting. Two suggestions:

Make a subclass of StandardUISubtitlePanel and override SetContent:

Code: Select all

public class MySubtitlePanel : StandardUISubtitlePanel
{
    public override void SetContent(Subtitle subtitle)
    {
        base.SetContent(subtitle);
        portraitName.color = //<-- ASSIGN YOUR COLOR HERE.
    }
}
Or add a script to the Dialogue Manager that has an OnConversationLine method:

Code: Select all

public Text portraitName; //<-- ASSIGN FROM DIALOGUE UI.

void OnConversationLine(Subtitle subtitle)
{
    portraitName.color = //<-- ASSIGN YOUR COLOR HERE.
}
You can store the color in a Text field on the actor in web format (#rrggbb) and then use Tools.WebColor() to get the Color value, like this:

Code: Select all

var actor = DialogueManager.GetActor(subtitle.speakerInfo.nameInDatabase);
portraitName.color = Tools.WebColor(actor.LookupValue("PortraitNameColor"));
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: Can I change the color of the portrait name per actor?

Post by AoF »

Cool, thanks a lot.
Post Reply