- Home /
 
how to have my texture appear on pause
var _texture : Texture; var paused : boolean = false;
function OnGUI () { GUI.DrawTexture(Rect(0,100,500,500), _texture); }
function Update () { if(Input.GetButtonUp ("Pause")) { if(!paused) { Time.timeScale = 0; paused = true;
 } else { paused = false; Time.timeScale = 1;
 
                }
  
               } 
}
Answer by efge · Jan 04, 2011 at 09:58 PM
You could use your _texture as a GUITexture, set it up in the inspector and enable/disable it in your script:
var _texture : GUITexture;
...
_texture.enabled = true; // or false
 
              Answer by Nicholas 1 · Jan 19, 2011 at 07:54 PM
like for example this is what i came up with... And i appreciate the feedback.
var _texture : Texture; var paused : boolean = false;
function Start () { paused=false; }
function Update () { if(Input.GetButtonUp ("escape")) { if(!paused) { Time.timeScale = 0; paused = true;
 } else { paused = false; Time.timeScale = 1;
 
                }
  
               } 
}
function OnGUI() { if(paused) {
 GUI.skin = menuSkin; //GUI.color = Color.White; //GUI.color.a = 0.5; if(GUILayout.Button("Restart Level")) {
 //OpenLevel("level01");
 Time.timeScale = 1.0;
 }
 if(GUILayout.Button("Quit To Menu")) {
 //OpenLevel("menu");
 Time.timeScale = 1.0;
 Application.LoadLevel(0); }
 GUI.DrawTexture(Rect(0,100,500,500), _texture); var ScreenX = ((Screen.width  0.5) - (areaWidth  0.5));
 var ScreenY = ((Screen.height  0.5) - (areaHeight  0.5));
 GUILayout.BeginArea(Rect(ScreenX, ScreenY, areaWidth, areaHeight));
 GUILayout.EndArea();
 } }
function OpenLevel (level : String) { audio.PlayOneShot(click); yield WaitForSeconds (0.5); Application.LoadLevel (level); }
Your answer
 
             Follow this Question
Related Questions
Way to have a pause and play texture in same GUI texture? 0 Answers
Making a pause Menu 5 Answers
Assigning UV Map to model at runtime 0 Answers
how to make substance material (subtance designer) 1 Answer
Pause and resume coroutine 1 Answer