- Home /
GUI.Label with down symbols
Good afternoon. By application programming I had a question. How to display the lower characters in one GUI.Label ()? For example, I want to see a water formula on the screen: H2O where number 2 - is see as the lower character. Thanks in advance for the help.
Answer by Eric5h5 · Jan 10, 2014 at 09:03 PM
Subscript numbers exist as Unicode characters, so you can type it in as text: H₂O. (On OS X, use the character palette with Symbols -> Numbers and Number Symbols.)
@Eric5h5 If it isn't difficult for you, you could give an example of use of it in GUI.Label (). And as I understand, the coding of the file shall be utf-8.
There's not really any example to give since there's nothing different from normal. It's just text. Find any example of GUI.Label that exists and plug it in. You should use UTF-16 if using C#. UTF-8 only seems to work with Unityscript.
@Eric5h5 Unfortunately it is impossible to me a little. For example(I write in CSharp):
GUI.Label(new Rect(0, 0, 100, 50), "H\u2082O");
Here '\u2082' value of the character lower 2 in Unicode. But unfortunately, on the screen at me an output: "H₂ O". For some reason for the lower characters 1, 2, 3 and 4 there is superfluous a distance, and for the remaining is normal (I use the Arial font). And how to me to make the lower characters if I there have a text?
Try using a different font. I couldn't understand your last question.
@Eric5h5 I use a font in unity by default (difficult to tell how it will be displayed on android the device). But I will try other fonts. Concerning the last question. For example, I display "Hello$$anonymous$$yFriend" text. And I want that the word "$$anonymous$$y" was displayed also, as well as number 2 in a water formula H₂O .
Your answer