So, I have a code that when a certain number of crystals are collected, a gui button pops up, that when clicked takes you to the next level. What can I add to my script that makes it so that when the button pops up, the player can not move and the enemies no longer attack you. So, is there like a pause control script or anything ?
[EDIT]
Okay, so I added a part to it and when it loads the next level it is still frozen. Here is what I have:
var message: Texture2D;
var button: Texture2D;
var nCrystals = 0;
var neededCrystals = 10;
var nextLevel = 0;
function OnGUI()
{
if (nCrystals >= neededCrystals)
{
savedTimeScale = Time.timeScale;
Time.timeScale = 0;
GUI.DrawTexture(Rect((Screen.width-message.width)/2, 200, message.width, message.height), message);
if (GUI.Button(Rect((Screen.width-button.width)/2, 400, button.width, button.height), button))
{
Application.LoadLevel(nextLevel);
Time.timeScale = 1.1;
}
}
}