[SOLVED] Subtitle text colour resetting after being changed

Announcements, support questions, and discussion for the Dialogue System.
Totem_Iain
Posts: 14
Joined: Mon Jun 28, 2021 10:47 pm

[SOLVED] Subtitle text colour resetting after being changed

Post by Totem_Iain »

Hi,

So, this is an odd issue that may have been in my project for weeks but I've only just noticed now. I've just implemented an accessibility settings menu that updates the colour, font, and font sizes on all UI elements that have my text and colour component scripts attached to them. When settings are changed, each component with the script is iterated through and updated colour/font/size is applied.

However, I've just noticed that, when I change the colour scheme after starting a conversation, the Subtitle Text component's colour will change to the new colour for only one line, and when a new line is generated will revert back to its starting colour (which is whatever colour scheme was in place before the dialogue template was instantiated).

I've also noticed if I change the colour (not even the text) of a disabled text component in the dialogue template, its size is set to 0 and thus is invisible when enabled.

Are these normal behavours? I've been trying to track down what could be making these changes for hours and have had no luck.
Last edited by Totem_Iain on Mon Sep 06, 2021 1:53 am, edited 2 times in total.
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: (Bug?) Subtitle text colour resetting after being changed

Post by Tony Li »

Hi,

Nothing in the Standard Dialogue UI system's subtitle panel code will reset the subtitle text color. Could some custom code be doing it?

Response menu buttons are different, however. The StandardUIResponseButton component has an option to always set the button text's color. To disable this option, untick the STandardUIResponseButton's Set Label Color checkbox.

To try to get to the bottom of the subtitle text issue, temporarily set the Dialogue Manager's Other Settings > Debug Level to Info. Then play through a conversation. The Dialogue System will log each line to the Console. Are any of them being wrapped in <color=XXX> rich text codes by any chance?
Totem_Iain
Posts: 14
Joined: Mon Jun 28, 2021 10:47 pm

Re: (Bug?) Subtitle text colour resetting after being changed

Post by Totem_Iain »

So strangely enough, the response menu text changes colour just fine. I thought maybe a custom script was changing the colour, however the only script I've written that should apply any sort of changes to the text component in the subtitle object is my TextComponent script, and even when I remove that script from the dialogue template the colours are still changing to the colour they started the scene as after each line.

Per your recommendation I changed the Debug Level to Info, and looking through the console nothing seems to be out of the ordinary. No <color=xxx> tags or anything like that (see attached):

https://drive.google.com/file/d/13DN311 ... sp=sharing

I do have a custom conversation logger that listens for OnConversationLineEnd(), but that's the only class of mine that's interacting with the Dialogue System beyond starting/ending conversations. As a (hopefully temporary) workaround, I could update the colour at the end of each line I suppose. >.<
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: (Bug?) Subtitle text colour resetting after being changed

Post by Tony Li »

Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?
Totem_Iain
Posts: 14
Joined: Mon Jun 28, 2021 10:47 pm

Re: (Bug?) Subtitle text colour resetting after being changed

Post by Totem_Iain »

Tony Li wrote: Thu Jul 29, 2021 8:24 am Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?
Hi Tony, so sorry for the late reply.

I'm afraid I can't currently, though I'll try to strip out just the dialogue system bits in a separate Unity project to send along to you when I have time.

In the meantime, though, I have noticed something odd. So as a short-term fix I created a simple script that would re-change the colour every time a new line is created, and attached that to the subtitle text GameObject in my conversation template prefab. That still isn't working, and not only is it not working but the console is telling me that my script's component on the text GameObject is being destroyed every time a new line is generated. None of my scripts are doing that, I can safely say, so is there something in the dialogue system that would be causing this behavour?
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: (Bug?) Subtitle text colour resetting after being changed

Post by Tony Li »

Hi,

Please check the settings of your subtitle panel's Standard UI Subtitle Panel component. There are some options that could affect text color, such as ticking 'Prepend Actor Name' and including rich text color codes in the actor name format string.

Also check for extra components on your actor GameObjects such as Actor Subtitle Color, or a Dialogue Actor component's 'Set Subtitle Color' checkbox.
Totem_Iain
Posts: 14
Joined: Mon Jun 28, 2021 10:47 pm

Re: (Bug?) Subtitle text colour resetting after being changed

Post by Totem_Iain »

Tony Li wrote: Mon Aug 09, 2021 10:12 am Hi,

Please check the settings of your subtitle panel's Standard UI Subtitle Panel component. There are some options that could affect text color, such as ticking 'Prepend Actor Name' and including rich text color codes in the actor name format string.

Also check for extra components on your actor GameObjects such as Actor Subtitle Color, or a Dialogue Actor component's 'Set Subtitle Color' checkbox.
I have gone through all Dialogue System scripts in my Dialogue UI, and as far as I can tell no colour-affecting options are ticked. I'm also not using any rich text at all (at least at the moment).

I also haven't up to now used any extra components on my actor GameObjects, except for a Dialogue System Events component on my Player object to use when pausing the game. The Actor Subtitle Color option has presented a possible work-around, though! In a test I've added those to my actors and added a line in my colour settings script to update their colours in addition to the rest, and it seems to have worked! Although it won't change the colour of a subtitle line that has already been generated.

Is there a way to refresh a dialogue line or have an entry play again? Because if so that will be a sufficient work-around for me to be satisfied :)
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Subtitle text colour resetting after being changed

Post by Tony Li »

Hi,

What do you mean by refreshing a dialogue line?

If you want to redisplay a line, it may depend on a few factors, such as whether you've configured the subtitle panel to accumulate text. (You won't want to accumulate text a second time, since that would append another copy of the text right after the original version.)

Let's look at this:

> I've just implemented an accessibility settings menu that updates the colour, font, and font sizes on all UI elements that have my text and colour component scripts attached to them. When settings are changed, each component with the script is iterated through and updated colour/font/size is applied.

How are you updating the color? Are you using Text components, TextMeshProUGUI components, or something else? Are you setting the component's color property (e.g., GetComponent<Text>().color = Color.red) or changing the color some other way?
Totem_Iain
Posts: 14
Joined: Mon Jun 28, 2021 10:47 pm

Re: Subtitle text colour resetting after being changed

Post by Totem_Iain »

Tony Li wrote: Tue Aug 10, 2021 8:56 am Hi,

What do you mean by refreshing a dialogue line?

If you want to redisplay a line, it may depend on a few factors, such as whether you've configured the subtitle panel to accumulate text. (You won't want to accumulate text a second time, since that would append another copy of the text right after the original version.)

Let's look at this:

> I've just implemented an accessibility settings menu that updates the colour, font, and font sizes on all UI elements that have my text and colour component scripts attached to them. When settings are changed, each component with the script is iterated through and updated colour/font/size is applied.

How are you updating the color? Are you using Text components, TextMeshProUGUI components, or something else? Are you setting the component's color property (e.g., GetComponent<Text>().color = Color.red) or changing the color some other way?
Sorry, I'm not sure how else to say it. Play the dialogue line again, I guess? As if it was playing for the first time? I just need to refresh it so it applies the colour from the Actor Subtitle Color component.

We are using TextMeshProUGUI components exclusively. The script that is applying colour changes from my accessibility settings menu is updating GetComponent<TextMeshProUGUI>().color, and as I mentioned before I working as intended for every other TMP component in the game, besides the subtitles panel, so I've switched tact completely. Now my settings menu is updating the colour on the Actor Subtitle Color component instead, which is working perfectly except for when you change the colour in the middle of a conversation, as it doesn't update the colour of the current line.
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Subtitle text colour resetting after being changed

Post by Tony Li »

When you change colors, can you also change the colors of the dialogue UI's Subtitle Text GameObjects? This should take care of the current line.

I still don't know why the colors are being reset in the first place, but if you're happy with using ActorSubtitleColor then that's a fine way to go. If you do want to investigate why the colors are being reset, please let me know if the TextMeshProUGUI's color property is reset or if the text property ends up with <color> rich text codes around it.
Post Reply