Different font style in same GUI paragraph

I know how to format labels and texts with different styles, but what I really can’t find is a way to have a GUI text (label or else) formatted so that it shows different styles in the same field.

Example: “I’m a single label but this is bold and this is not”.

As of now I do that using more than one text field, but I’d really need to use different styles in the same one. Anyone knows if it’s possible? Thanks.

If it’s just a single part you can just use two labels with two styles. If you use GUILayout (which i would strongly recommend) you don’t need to do much more. You could do all this in your own function that recognises control-tags in your string (like EZ-GUI does) and use a seperate Label for each part. But keep in mind that using multiple GUIStyles will pull on your performance since every GUIStyle is at least one draw-call.

EZ-GUI can do a color change via vertex colors so you can have the whole thing as one drawcall, but settings like bold, italic and so on can’t be applied per character.

How exactly do you want to tell Unity to display a part of a string differently? Do you also want to use some kind of string tags?

Another way would be to create a font texture with 3 complete character sets(normal, bold, italic), so you can choose the style by adding an numeric-offset to your characters (to the ascii code) to display a different style for a character.

If you have a lot text with a lot different styles / colors you should go for a mesh approach like EZ-GUI and other GUI libraries. I would say the EZ-GUI is definitely worth the price. There’s a lot of work in it. If you would hire a programmer to write something similar it would take days, imagine the costs. As an indy / student developer i would always do it myself.

the EZ-GUI videos may give you a start clear answer :

http://www.anbsoft.com/middleware/ezgui/sprite_text/index.html