Page 1 of 1
Highlighting subtitle text
Posted: Thu Feb 18, 2016 2:11 pm
by nishant
Hi,
Is there any way to highlight important words in a subtitle ?
Thanks.
Nishant
Re: Highlighting subtitle text
Posted: Thu Feb 18, 2016 3:42 pm
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.
Re: Highlighting subtitle text
Posted: Thu Feb 18, 2016 5:28 pm
by nishant
Perfect ... just what I wanted ...
Thanks
Re: Highlighting subtitle text
Posted: Thu Feb 18, 2016 5:36 pm
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.
Re: Highlighting subtitle text
Posted: Thu Feb 18, 2016 8:06 pm
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."