How can I change the colour of individual characters in a text string

I simply have a paragraph of text and in my C# script I want to change the colour of individual letters at a specific index.

For example, my paragraph is rendered white on a white background and I want to turn each letter to black starting from the first and going through to the end.

I’m using a loop and I want to do something like this:

for (int i = 0; i < stringLength; i++)
{
myText.text*.color = black;*
}
Now I can read each letter by using
Debug.Log(myText.text*);*
so shouldn’t it be really simple to just edit the colour of the letters at those indices?

It doesn’t work that way.

Which component do you use to display the text? If it’s UI.Text, you can use markup to display rich text which allows to color the text.

Thanks for the quick answer, yes it’s UI.Text.

How would I go about using tags to change each character’s color? I’ve seen people using Replace but that seems to change all letters of one type, eg it would go through and change each “A” to a “B” or whatever you specified.

I just want to go, render first char black, then render second char black, etc.