Unity 3D Android Pause Game !

Advertisemen

Unity 3D Android Pause Game !
































THIS IS Java# script: GOOD 4 2D GAMES AND 3D GAMES !
----------------------------------------­­­­­­­----------------------------------­-­-­-­-­-­-­------

DIRECT DOWNLOAD HERE




THIS IS BACKUP  IN TEXT FORM  TUTORIAL

1. Create New java and name it : PauseUpgrade


2. Copy & Past this text and save java :
----------------------------------------­­­­­------------------------------------­-­-­-­-­-


#pragma strict
 var pause : boolean = false;

function Update () {
       for(var i:int = 0; i < Input.touches.Length; i++)//How many touches do we have?
     {
         var touch:Touch = Input.touches[i];//The touch
         var ray:Ray = Camera.main.ScreenPointToRay(touch.position);
         var hit:RaycastHit = new RaycastHit();

         if(Physics.Raycast(ray,hit, 1000))
         {
             if(hit.collider.gameObject == this.gameObject)
             {
                 switch(touch.phase)
                 {
                     case TouchPhase.Began://if the touch begins
                   
                        if (pause == false)
 {
 pause = true ;
 Time.timeScale = 1 ;

 return;
 }

 if (pause == true)
 {
 pause = false;
 Time.timeScale = 0 ;
  return;

 }
 }
 }
 }
 }
 }






 ----------------------------------------­­­­­------------------------------------­-­-­-­-­-















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