Advertisemen
Unity3D Simple Simple pause Tutorial 9
THIS IS Java scrip: GOOD 4 2D GAMES AND 3D GAMES !
Name script : pauseGame and copy - pass this down text
--------------------------------------------------------------------------------------
#pragma strict
private var pauseGame : boolean = false;
function Update()
{
if(Input.GetKeyDown("p"))
{
pauseGame = !pauseGame;
if(pauseGame == true)
{
Time.timeScale = 0;
pauseGame = true;
GameObject.Find("Main Camera").GetComponent(MouseLook).enabled = false;
GameObject.Find("First Person Controller").GetComponent(MouseLook).enabled = false;
}
}
if(pauseGame == false)
{
Time.timeScale = 1;
pauseGame = false;
GameObject.Find("Main Camera").GetComponent(MouseLook).enabled = true;
GameObject.Find("First Person Controller").GetComponent(MouseLook).enabled = true;
}
}
---------------------------------------------------------------------------------
Or Try This Alternative Java Script : Add 2 cam and press P :)
---------------------------------------------------------------------------------
//*
//*
var paused : boolean = false;
function Update () {
if(Input.GetKeyDown("p") && paused == false) {
paused = true;
Time.timeScale = 0;
}
else if(Input.GetKeyDown("p") && paused == true) {
paused = false;
Time.timeScale = 1;
}
}
---------------------------------------------------------------------------------
Copyright Free Music in this video by:
Song: Virtual Riot - Energy Drink
» Download:
http://bit.ly/RebornDownload
Creative Commons License
http://creativecommons.org/licenses/b...
Artist's Links:
Virtual Riot - Energy Drink
http://www.facebook.com/virtualriotmusic
http://www.soundcloud.com/virtual-riot
Advertisemen
Tidak ada komentar:
Posting Komentar