- Home /
 
               Question by 
               Anonymous 1 · Aug 16, 2011 at 09:10 AM · 
                androidiphonetouchhittest  
              
 
              Detecting Touch on Iphone and Android
          function Update()
 {
  for (var touch : Touch in Input.touches)
  {
   if (guiTexture.HitTest (touch.position))
   {
     // we are now in the guitexture
     Debug.Log("Touch"); 
     exit;
   }
  }
 }
or this one
   if(Input.touchCount > 0)
 {
     var touch: Touch = Input.touches[0]; 
 
     if(touch.phase == TouchPhase.Began && guiTexture.HitTest(touch.position))
 
     {
        //Do Stuff Here
      } 
 }
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by luckruns0ut · Aug 16, 2011 at 09:36 AM
at the top you need public Touch touch;, under the class name etc..
if(Input.touchCount > 0) { touch = Input.touches[0];
 if(touch.phase == TouchPhase.Began && guiTexture.HitTest(touch.position))
 {
    //Do Stuff Here
  } 
}
tell me if this doesnt work and ill try again
I will make a public tTex and assign a guiTexture to it and will then replace the guiTexture in script with tTex . And i will add this script in void Update
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                