Unity3D Simple Simple pause Tutorial 9

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

Disclaimer: Gambar, artikel ataupun video yang ada di web ini terkadang berasal dari berbagai sumber media lain. Hak Cipta sepenuhnya dipegang oleh sumber tersebut. Jika ada masalah terkait hal ini, Anda dapat menghubungi kami disini.

Tidak ada komentar:

Posting Komentar

© Copyright 2017 Tutorial Unity 3D