I’ve read at least 5 posts about this subject, but they didn’t have the right answer to solve it. Therefore I make this post.
My problem is as follows: I have a GUISkin used for my menu’s. If I have the following OnGUI function, the time is displayed correctly:
void OnGUI ()
{
GUI.skin = skin;
GUI.Label (new Rect (10, 40, 400, 400), "Time: " + currTimer);
}
However, after I made a custom style called “Time_Label”, I wrote this code:
void OnGUI ()
{
GUI.skin = skin;
GUI.Label (new Rect (10, 40, 400, 400), "Time: " + currTimer, skin.GetStyle("Time_Label"));
}
And now the time doesn’t get displayed. What’s wrong?