Hi! I am trying to get a string to appear as a different color as the rest of the text. Is there a “not to complicated” way of doing this? Here’s my script:

if(k.Display == true)
				{
				 GUI.Label(new Rect(Screen.width/2, k.Row * rowHeight, Screen.width * (3.0f/2.3f), Screen.height * (0.3f/6.3f)), "You terminated " + k.Killed);
				}

I would like to have k.Killed in, lets say, blue. Anybody know how I could do that? Thank you in advance!

Use Unity Rich Text formatting syntax. In your case, you can replace

"You terminated " + k.Killed

with

"You terminated <color=blue>" + k.Killed + "</color>"

or

string.Format("You terminated <color=blue>{0}</color>", k.Killed)

Here’s one more:

    public static string ColorString(string text, Color color)
    {
        return "<color=#" + ColorUtility.ToHtmlStringRGBA(color) + ">" + text + "</color>";
    }

Use GUI.color for that.

Edit: Oh, for the rest of the text, not the entire string, did not see that first. Then you need to do it separately. Write the first part of the string with one Label, then change color, and write the colored part with another Label.

Is it possible to add an outline color instead of changing the color of the whole text?