- Home /
GUI Texture Pause Button
#pragma strict
var totalScore : int = 0;
var temp : int = 0;
var higestDistance = 0;
var scoreInfoVariable : GUIText;
var fpc :GameObject;
internal var showMenu : boolean = false;
var platform06 : GameObject;
function Start () {
Screen.showCursor = false;
}
function Update () {
if (Input.GetKeyDown ("escape")){
if (Screen.showCursor == false) {
fpc.SendMessage("ToggleInputCursor", true);
Screen.showCursor = true;
showMenu = true;
Time.timeScale = 0;
}
else {
ResumeGame();
}
}
}
function UpdateScoreInfoGUI( distance : int) {
totalScore = totalScore + distance;
scoreInfoVariable.text = ""+ totalScore;
}
function ActivatePlatformPrefab06(){
platform06.active = true;
print("message is received");
}
function OnGUI(){
if(showMenu == true)
{
GUI.BeginGroup(Rect(Screen.width/2 - 50, Screen.height/2 - 50, 100, 90));
GUI.Box(Rect(0, 0, 100, 90), "Menu");
if(GUI.Button(Rect(10, 30, 80, 20), "Resume")){
print("you clicked RESUME");
ResumeGame();
}
if(GUI.Button(Rect(10, 60, 80, 20), "Quit")){
print("you clicked QUIT");
Application.Quit();
}
GUI.EndGroup();
}
}
function ResumeGame(){
Screen.showCursor = false;
fpc.SendMessage("ToggleInputCursor", false);
showMenu = false;
Time.timeScale = 1.0;
}
Hi Guys; This my code and i don't know how can i add GUI Skin in code.
When i click this button show menu.How can i do this.
NOTE: It's android game so how can i replace Input.GetKeyDown to GUI skin button.
Thanks For reading.
Comment
Sorry for spam$$anonymous$$g but someone answer ?
Thanks.
Your answer
Follow this Question
Related Questions
Button reaction time problem 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
touch position to world position 2D 2 Answers
Score system 1 Answer
How do I edit the first person controller to work with android? 0 Answers