I tried:
aGuiText.font.material.SetFloat("FontSize", 8f)
but that doesn’t work.
I checked if the FontSize property existed using:
aGuiText.font.material.HasProperty("FontSize")
and it returned true which means that the shader has that property.
Since the shader is the one with that property, I figured I could use:
aGuiText.font.material.shader.SetGlobalFloat("FontSize", 8f)
but it wouldn’t let me access the property from an instance. Fair enough. I can just access it statically. But then, I start to ask myself: if I change the global value of the shader, will that affect all the fonts in the project; and, even if it does only affect the current font, since I’ll be changing a static value, does that mean that I have to change it back to its original value if I want to use the same font again but in its original size? Of course, there’s the question of whether this will actually accomplish what I’m trying to do, which is scale the font size during runtime.
(Creating a copy of the font with different sizes is obviously an option, but do you really want the player to download all those assets just so you can cover all the screen resolutions that your game aims to support? =P)