Any way to change text color on individual words in EditorGUILayout.textfield/textarea?

We have a bunch of custom editors that we use to build our games. We insert code snippets directly into them, since when they get saved, they write the data to c# files. (This allows our content designers to easily navigate the many systems in the game without losing compile time errors.)

This has been working great for everyone … my only real issue is the readability (not to mention lack of code completion, but oh well). It would go a long ways if there were a way to color/bold/italicize keywords.

I’m not expecting it … but I figured I would ask. I would love to turn our “GameFlags.X” into one color, strings into another color, etc etc. Not to mention being able to draw squigglies if I know something is wrong.

It’s not super convenient, but you can do it per field (I’m not sure about per-word). GUI drawing functions can take a bunch of optional parameters that can set, one of the being GUIStyle. A GUIStyle can set font settings, such as size and color. Some of the font settings you want to set may be hidden under UI states such as “normal” and “hover”.

Simple example:

GUIStyle style = new GUIStyle();
style.normal.textColor = Color.green;
style.fontSize = 40;

You can get a copy of built-in GUIStyles for modifying by accessing them through the GUI.skin accessor. This is not necessary in most cases.