How to have the character name a different color

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Embro674
Posts: 2
Joined: Tue Aug 29, 2023 6:13 pm

How to have the character name a different color

Post by Embro674 »

I have scrolling text that is appended that look like the below:

"Person 1: Hello!"
"Person 2: What's up?"

What I am looking for is a way to to have the "Person 1:" and "Person 2:" Parts a different color/boldened. This would help the different conversation entries seem more distinct. Thank you!
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to have the character name a different color

Post by Tony Li »

Hi,

If you want to use the same color for all actors' names, inspect the subtitle panel in your dialogue UI. Tick Add Speaker Name. Set the Add Speaker Name Format to something like:

Code: Select all

[em1]{0}[/em1]: {1}
The {0} will be replaced by the actor's name. The {1} will be replaced by the dialogue text. The [em1]...[/em1] are emphasis tags, whose appearance you can set in the Dialogue Editor's Database section.

If you prefer to use rich text codes, you can use those instead, like:

Code: Select all

<color=red><b>{0}</b></color>: {1}
If you want to use a different color/style for each actor, leave Add Speaker Name UNticked. Instead, add a Dialogue Actor component to the actor's GameObject. If the actor doesn't have a GameObject, you can create an empty one. Set the Actor field. Then tick Set Subtitle Color and Apply Color To Prepended Name.
Embro674
Posts: 2
Joined: Tue Aug 29, 2023 6:13 pm

Re: How to have the character name a different color

Post by Embro674 »

The "[em1]{0}[/em1]: {1}" Didn't work, it just made the name display as; "[em1]Name[/em1]: Hello World!".

However, adding the "Dialogue Actor component" worked exactly how I wanted. Thank you very much!
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to have the character name a different color

Post by Tony Li »

Hmm, I'll check that the first option properly parses the [em#] tags. Anyway, I'm glad the Dialogue Actor approach met your needs!
Post Reply