Hi....
I have this script
var myTimer : float = 5.0;
function Update () {
if(myTimer > 0){
myTimer -= Time.deltaTime;
}
if(myTimer <= 0){
Debug.Log("GAME OVER");
Application.LoadLevel("GameOver");
}
}
function OnGUI(){
GUI.Label( Rect(Screen.width - 200, 0, 200, 30), "Time: " + myTimer);
}
and i want the "Time: " to get the font,the size,the color and those things from my GUISkin. So i make this...
var myTimer : float = 5.0;
var mySkin : GUISkin;
function Update () {
if(myTimer > 0){
myTimer -= Time.deltaTime;
}
if(myTimer <= 0){
Debug.Log("GAME OVER");
Application.LoadLevel("GameOver");
}
}
function OnGUI(){
GUI.skin = mySkin;
GUI.Label( Rect(Screen.width - 200, 0, 200, 30), "Time: " + myTimer);
}
but its not working while with the same GUISkin i made this to work...
var score = 0;
var scoreText = "Score: 0";
var mySkin : GUISkin;
function OnTriggerEnter( other : Collider ) {
Debug.Log("OnTriggerEnter() was called");
if (other.tag == "Coin") {
Debug.Log("Other object is a coin");
score += 5;
scoreText = "Score: " + score;
Debug.Log("Score is now " + score);
Destroy(other.gameObject);
}
}
function OnGUI () {
GUI.skin = mySkin;
GUI.Label (Rect (10, 10, 500, 200), scoreText.ToString()); }
Can you correct the Script so the GUISkin works??? Thank you.