Terminal Hacker Font Colors

So I am going a bit off script with the terminal hacker and need a way to change only certain parts of the font on a page to a different color.

I have tried turning Rich Text on and using the color tags and the tags just print out. I have also tried:

variable:

Text text;

in start()

text = gameObject.GetComponentInChildren<Text>();

in method

text.color = Color.yellow;
Terminal.Writeline("foobar");
font.color = color.green;`

and this just makes the Terminal.Writeline text break at that position.

EDIT: I managed to get it to print without errors, but the color still only changes to the last color selected in the code. It does not separate colors on the same screen.

Any ideas?!?

I don’t think there’s any easy way to do what you want. For one, Terminal.Writeline isn’t set-up to compose a single line of output from multiple calls to Writeline. But, even if you were to “fix” that, I think the textbox object operates in a way that it’s content is “painted” from a single “material”.

I wish I knew the technology better, so as to give a better explanation; by the same token, I may also be mistaken on the 2nd assumption there, but I don’t know any way to have two materials on one object at the same time.

1 Like

Thanks for the reply. From all I have been reading on google, you seem to be right. Maybe in Unity 2018! :stuck_out_tongue:

1 Like

What’s handy about Terminal.Writeline is not only that is manages the “I/O buffer”, if you will, but that it also employs a Unity built-in system for managing GUIText. The way it seems to be designed, is to turn basically the entire display into one single “textbox” (thus, one material for rendering).

Option A

The only way past this using the built-in textbox utilities, is to build functionality that keeps track is what text is precisely where on the screen at any time, allowing any unique bits of text to have their own unique material because they are distinct objects.

Option B

If you are feeling very brave, there is a free asset called TextMeshPro which might be a faster way to get to where you want to go… It is a drop-in that you can use in lieu of Unity GUIText objects and gives a ton of flexibility (such as using RTF to control text colour) but doing so is waaay beyond what a student is expected to be doing at this stage in the course.

Option C

Wait for: your comfort level doing it yourself to increase to a suitable level, or for Unity to enhance their GUIText utilities. :slight_smile:

1 Like

Privacy & Terms