I am using several GUITexts for displaying player name and score etc. Is it possible to dynamically change the size and color of a GUIText in script? Or do we have to use UnityGUI functions and GUIStyles for that?
I guess a related question is:
Can a Font have more than one material associated with it? Or do I have to duplicate the .ttf font file and just treat it like a separate font completely.
Thanks dreamora. By related transformation, you mean the gameobject the component is attached to? I tried that but it apparently doesn’t change the size… It seems to work differently for GUIText than GUITexture.
You are naturally right, sorry.
Its only the position thats taken from the transform.
The PT size and alike are taken directly from the font you apply which is fixed to 1 font size. so you would have to create several fonts each with its own setup and just switch between them.
No, it’s the scale, too. Only if you turn “pixel correct” off, though. But this is generally a good idea, because 1) You can make a resolution-independent GUI, and 2) You can just change the scale to get different size fonts instead of needing multiple copies of the font. And yes, you can make different colors the usual way (i.e., change material.color).
Yeah. Just realized that as well. Tried to find the required setup for scale in a different project than where I used and didn’t realize that the option was set. stupid me.