How to have GUI Text change when the player types

I want to have text on the screen and the player has to type it out and as each letter is filled in the text turns a different colour. I have tried to do it using a new GUI Text for every letter but it wasn’t perfect. How would I go about this?

Make sure the GUIText has rich text enabled:

http://docs.unity3d.com/Documentation/ScriptReference/GUIText-richText.html

Then you can use html-style markup as documented here:

http://docs.unity3d.com/Documentation/Manual/StyledText.html

Now your problem boils down into working out how to generate the marked up string. I think I’d handle this by keeping a count of the number of characters that have been entered correctly, then split the string at that point. Stuff to the left of the cut point have been typed, so mark them up in red, and stuff to the right has yet to be typed, so mark them up in white. So, is the string is HelloWorld and you’ve typed up to the W then you’ve typed 6 characters, so you have HelloW and orld, so you can create <color=red>HelloW <color=white>orld.