Wednesday, 17 June 2015

Unity 3D Android Pause Game !

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;

 }
 }
 }
 }
 }
 }






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















0 comments:

Post a Comment