I have spent numerous amounts of time trying to comprehend how to do this;
the wiki has nothing good; nor the reference; but on google, I found this
Yet still, I was confused,
this is what I have so far.
I have spent numerous amounts of time trying to comprehend how to do this;
the wiki has nothing good; nor the reference; but on google, I found this
Yet still, I was confused,
this is what I have so far.
font is the font that is uses
try Style.fontSize
Create a new unity project. Make a c# script called fontsize.cs and paste the following code in:
// c# example
using UnityEngine;
using System.Collections;
public class fontsize : MonoBehaviour {
void OnGUI() {
GUIStyle g = GUI.skin.GetStyle("label");
g.fontSize = (int)(20.0f + 10.0f * Mathf.Sin(Time.time));
GUI.Label(new Rect(10, 10, 200, 80), "Hello World!");
}
}
As you probably know, the GUI system uses collections of styles grouped into skins. What this code does is simply grab the out-of-the-box style for the label component, and animate it’s font size. When you run the code you’ll note that the font doesn’t smoothly change size because their are not an infinite number of font sizes. This relies on the default (Arial) font being loaded and marked as dynamic. You cannot change the size of any font that’s not marked as dynamic.
So… um… can you explain line 9?
I’ve never used Mathf