Help!!!
I want to pause my game when after i click the mouse.
i can’t get it right.
Here’s my code:
#pragma strict
private var guiOn = false;
var wasClicked : boolean;
var paused : boolean = false;
function OnMouseDown()
{
wasClicked = true;
OnPausedGame();
Activate();
}
function OnMouseEnter()
{
if (wasClicked)
{
Activate();
}
}
function Activate()
{
guiOn = true;
OnPausedGame();
//OnGUI();
}
function OnGUI()
{
if (guiOn)
GUI.Box(new Rect(0, Screen.height - 50, 300, 100), "test");
}
function OnPausedGame()
{
if (wasClicked)
{
if (!paused)
{
Time. timeScale = 0;
paused = true;
OnGUI();
}
}
}