Highlighting subtitle text

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Highlighting subtitle text

Post by nishant »

Hi,
Is there any way to highlight important words in a subtitle ?

Thanks.
Nishant
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Highlighting subtitle text

Post by Tony Li »

Hi Nishant,

Yes, you can use emphasis markup tags:

Code: Select all

This is [em1]IMPORTANT[/em1] text.
Or you can use rich text:

Code: Select all

This is <b><color=yellow>IMPORTANT</color></b> text.
If you use emphasis tags, on the Dialogue Manager tick Display Settings > Subtitle Settings > Rich Text Emphases. You can customize the appearance of the emphasis tags on the Dialogue Editor's Database tab.
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Re: Highlighting subtitle text

Post by nishant »

Perfect ... just what I wanted ...

Thanks :)
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Re: Highlighting subtitle text

Post by nishant »

Another question regarding this. Can I somehow change the highlight color on runtime ? Thing is my UI supports many themes of different colors and I want the highlighted color to be relative to the selected theme.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Highlighting subtitle text

Post by Tony Li »

Here are two ideas:

Option 1: Change the master database's EmphasisSettings at runtime. This is a 4-element array. For example:

Code: Select all

DialogueManager.MasterDatabase.emphasisSettings[0].color = Color.blue; // emphasisSettings[0] corresponds to [em1]
One thing to note: The dialogue database is an asset file in the project. For efficiency, in playmode the Dialogue System doesn't instantiate a duplicate copy of the Initial Database assigned to the Dialogue Manager. It uses the asset directly. If you change the emphasis settings, the asset file will be changed. So make sure to initialize the emphasis settings before using them in case a previous run of the game left them with different values.


Option 2: Use [lua] or [var] markup tags. For example, say you've stored the current theme's color in a dialogue database variable named themeColor. You can use this rich text code in your Dialogue Text:
  • Dialogue Text: "This is <color=[var=themeColor]>IMPORTANT</color> text."
So if you've set themeColor to "blue", this is equivalent to:
  • Dialogue Text: "This is <color=blue>IMPORTANT</color> text."
Post Reply