Change colour of accumulated text

Announcements, support questions, and discussion for the Dialogue System.
blop
Posts: 3
Joined: Mon Apr 24, 2023 8:09 am

Change colour of accumulated text

Post by blop »

Hi Tony

I was searching through previous posts to find tips on how to change the colour of accumulated text, to direct a players eye to new text and responses, and came across this post:

https://www.pixelcrushers.com/phpbb/vie ... f=3&t=5978

So I applied that but strangely enough it only seems to apply to the very first line of dialogue in my conversation. I'm using the Scrolling Dialogue UI and I'm having difficulty spotting the source of the issue, although I'm sure it's probably something small I've missed :lol:

One additional thing, in the script it changes the colour of the text, but say you have different colours for actor names which you wanted to retain, how would you go about that? Changing the alpha of the text colour? Apologies if that is a bit outside the realm of Dialogue System specific questions.

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

Re: Change colour of accumulated text

Post by Tony Li »

Hi,

Does the example scene work correctly in your project? You should see that it colors all accumulated text gray.

If you want to retain the colors of actors' names, you'll need to modify the GrayAccumulatedText script to not remove the <color> tags around actor names.
blop
Posts: 3
Joined: Mon Apr 24, 2023 8:09 am

Re: Change colour of accumulated text

Post by blop »

Yeah the example scene is working as intended and I'm using the same script from that example in my dialogue UI.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change colour of accumulated text

Post by Tony Li »

If you want to get to the bottom of the issue where only the first line is grayed out, please reproduce the issue. Play through three lines so that the first line is gray, the second line isn't gray, and the third line is the regular subtitle color.

Then pause the game, inspect the Subtitle Text GameObject, and copy-paste the text into a reply here.
blop
Posts: 3
Joined: Mon Apr 24, 2023 8:09 am

Re: Change colour of accumulated text

Post by blop »

Figured out the issue in doing what you advised, on the Dialogue Actor component I had the Set Subtitle Color and Apply Color To Prepended Name options ticked, so that I could do some formatting for specific actors. Just as a test I commented out the if statement in the script to see if it would work without removing the 'color' tags and it did, so I guess from here I'll need to remove some further tags in the if statement.

Thanks for the advice here Tony, much appreciated.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change colour of accumulated text

Post by Tony Li »

Glad to help!
colorbar
Posts: 12
Joined: Sun Apr 30, 2023 10:35 pm

Re: Change colour of accumulated text

Post by colorbar »

blop wrote: Mon Apr 24, 2023 3:44 pm Figured out the issue in doing what you advised, on the Dialogue Actor component I had the Set Subtitle Color and Apply Color To Prepended Name options ticked, so that I could do some formatting for specific actors. Just as a test I commented out the if statement in the script to see if it would work without removing the 'color' tags and it did, so I guess from here I'll need to remove some further tags in the if statement.

Thanks for the advice here Tony, much appreciated.
For someone who isn't exactly an expert on coding, could anyone show an example of what the code would look like after this change? I'm also colouring prepended names in the dialogue actor component, but would like everything to be grey after the player moves on to the next line.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change colour of accumulated text

Post by Tony Li »

Hi,

The code linked above (in this post) should handle that. If not, let me know what it's currently doing in your project and how you'd like it to work differently.
colorbar
Posts: 12
Joined: Sun Apr 30, 2023 10:35 pm

Re: Change colour of accumulated text

Post by colorbar »

Tony Li wrote: Tue May 23, 2023 8:13 am Hi,

The code linked above (in this post) should handle that. If not, let me know what it's currently doing in your project and how you'd like it to work differently.
Hi, I'm using a version of the Scrolling Dialogue UI and put that script (from the other thread) into the Subtitle Text Game object.

The first line of dialogue is grayed out as expected, the second line (a player response) is the colour that is set for the player's name. Then the third line is the NPC again which is how I mean for it to look until it turns gray.

Sorry for the blurring of the NPC's name, I don't know the rules on content here and don't want to get banned.

Image https://pasteboard.co/ONUO8d05HxHO.png

Am I able to pick the colours for each character's name, but have white text for the rest and then once the player has moved from that line to the next, it turns gray?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change colour of accumulated text

Post by Tony Li »

Hi,

Try putting the script on the top-level dialogue UI GameObject.
Post Reply