- Home /
Question by
fullmetal_k15 · Oct 13, 2017 at 01:41 PM ·
guiprogramminggridlabelskin
My Label was working properly until I Decided to use GetStyle. Now my Label is just not been displayed on the screen.,My Label was working properly until I decided to use GetStyle.
using UnityEngine; using System.Collections; using UnityEngine.SceneManagement;
public class GameManagement : MonoBehaviour { public static int currentScore; public static int highScore;
public static int currentLevel=0;
public static int unlockedLevel;
public Color warningColorTimer;
public Color defaultColorTimer;
public GUISkin skin;
public Rect timerRect;
public float startTime;
private string currentTime;
void Update()
{
startTime -= Time.deltaTime;
currentTime = string.Format ("{0:0.0}", startTime);
if (startTime<=0)
{
startTime = 0;
Application.LoadLevel (2);
}
}
void Start()
{
DontDestroyOnLoad (gameObject);
}
public static void CompleteLevel()
{
currentLevel++;
//Application.LoadLevel (currentLevel);
SceneManager.LoadScene(currentLevel);
}
void OnGUI()
{
GUI.skin = skin;
if (startTime < 5f) {
GUI.skin.GetStyle("time").normal.textColor = warningColorTimer;
}
else {
GUI.skin.GetStyle("time").normal.textColor = defaultColorTimer;
}
GUI.Label (timerRect, currentTime,GUI.skin.GetStyle("time") );
}
}
Comment