I have a skin (MySkin). How to solve this problem?
My script is here.
using UnityEngine;
using System.Collections;
public class CarpismaScript : MonoBehaviour {
public static bool isGameOver = false;
public GUISkin skin;
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI()
{
GUI.skin = skin; //use the skin in game over menu
//check if game is not over, if so, display the score and the time left
if (!isGameOver) {
GUI.Label (new Rect (10, 10, Screen.width / 5, Screen.height / 6), "TIME LEFT: " );
GUI.Label (new Rect (Screen.width - (Screen.width / 6), 10, Screen.width / 6, Screen.height / 6), "SCORE: " );
}
//if game over, display game over menu with score
else {
Time.timeScale = 0; //set the timescale to zero so as to stop the game world
//display the final score
GUI.Box (new Rect (Screen.width / 4, Screen.height / 4, Screen.width / 2, Screen.height / 2), "GAME OVER
YOUR SCORE: ");
//restart the game on click
if (GUI.Button (new Rect (Screen.width / 4 + 10, Screen.height / 4 + Screen.height / 10 + 10, Screen.width / 2 - 20, Screen.height / 10), "RESTART")) {
Application.LoadLevel (Application.loadedLevel);
}
//load the main menu, which as of now has not been created
if (GUI.Button (new Rect (Screen.width / 4 + 10, Screen.height / 4 + 2 * Screen.height / 10 + 10, Screen.width / 2 - 20, Screen.height / 10), "MAIN MENU")) {
Application.LoadLevel (1);
}
//exit the game
if (GUI.Button (new Rect (Screen.width / 4 + 10, Screen.height / 4 + 3 * Screen.height / 10 + 10, Screen.width / 2 - 20, Screen.height / 10), "EXIT GAME")) {
Application.Quit ();
}
}
}
void OnCollisionEnter(Collision theCollision){
if (theCollision.gameObject.name == "Base") {
isGameOver = true;
}
}
}