- Home /
Question by
Domo23000 · Jun 26, 2018 at 05:19 AM ·
textcolorstringrichtextbox
How do I add color to a string
I know that you can add color to text, and have done it in a few projects using this code:
crimeSeverityText.text = "Crime Severity : <color=#008000FF>Mild</color>";
But I can't figure out how to color this text:
text.text = "Talk to " + "< color =#FDE67FFF> collision.transform.name </color>";
I'm trying to color collision.transform.name, and have tried both
"< color =#FDE67FFF> collision.transform.name </color>"
and
"< color =#FDE67FFF>" + collision.transform.name + "</color>"
but neither are working for me
Comment
Best Answer
Answer by seandolan · Jun 26, 2018 at 05:28 AM
I am not sure if it matters, but you have spaces around "< color =" part. Does removing the spaces work?
yeah i just figured that out myself too, but thanks for the help!