Color Change

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
jrose1184
Posts: 69
Joined: Mon Jan 22, 2024 2:35 pm

Color Change

Post by jrose1184 »

Hi,

Is there a feature where i can change the color of some words in a dialouge to highlight its important.

Also can i add images to the text so for instance i have a instruction of what the player needs to do i.e press B would like to swap B to a keyboard button image.

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

Re: Color Change

Post by Tony Li »

Hi,

You can use emphasis ([em#] ... [/em#]) markup tags or rich text tags to change color. I recommend emphasis markup tags because you can customize their appearance in the Dialogue Editor's Database > Database Properties > Emphasis Settings section. This way if you decide you want to use a different color you can change it there and the change will apply everywhere you've used the emphasis tag. If you use rich text tags, on the other hand, you'll have to manually go through each instance of the tag and update the color. (You can use the Dialogue Editor's Global Search & Replace feature, but it's still not as easy as emphasis tags.)

If you do use rich text tags for some things, I recommend using TextMesh Pro (see TextMesh Pro Support). You can also use TextMesh Pro <sprite> tags to include images in your dialogue text. You can use variables with the sprite tags to change which sprite to show based on the player's input device. For example, say you have two sprites: "B_button" and "E_key". You'd normally use a tag such as:

Code: Select all

<sprite name="B_button">
but if you use a variable you can use:

Code: Select all

<sprite name="[var=InteractInput]">
and then set the value of Variable["InteractInput"] to either "B_button" or "E_key". For example, if you do this in C# code, it might look like:

Code: Select all

DialogueLua.SetVariable("InteractInput", "E_key");
jrose1184
Posts: 69
Joined: Mon Jan 22, 2024 2:35 pm

Re: Color Change

Post by jrose1184 »

Thank you
User avatar
Tony Li
Posts: 23238
Joined: Thu Jul 18, 2013 1:27 pm

Re: Color Change

Post by Tony Li »

Glad to help!
Post Reply