Touch Button android

I would like to now, if I can use the same method to create a Touch
button Android using a custom GUI button,

custom GUI button:_______________________________________________

/* Overriding the default Control Style with one you’ve defined yourself */
// JavaScript
var customButton : GUIStyle;
function OnGUI () {
// Make a button. We pass in the GUIStyle defined above as the style to use
GUI.Button (Rect (10,10,150,20), “I am a Custom Button”, customButton);
}


And this is my script:


function Update () {
if(Input.touchCount >= 0) {
var touch : Touch = Input.touches[0];
if(touch.phase == TouchPhase.Began)
{
animation[“Play”].speed= 1.0;
animation.Play(“Play”);
ResetAnimation(animation[“Play”]);
}
}
}
function ResetAnimation(curAnim : AnimationState)
{
yield WaitForSeconds(curAnim.length);
animation.Play(“Idle”);
}


the problem with my script is that it work with the whole screen, I
need a touch button, working just when touching it with the
finger on android screen cellphone, a ot the whole screen.
Please help me…

GUI.Button works on all devices, not just PC/Mac. If I understand correctly, you want to make a button, which will trigger an animation. To do this, just create a GUI.Button, in the exact same way you explained the custom button. Your code should look something like this:

var customButton : GUIStyle;
var text : string = "";
function OnGUI()
{
   GUI.Label(Rect(160,10, 200, 20), text)
   if (GUI.Button(Rect (10,10,150,20), "I am a Custom Button", customButton))
   {
      animation["Play"].speed= 1.0; 
      animation.Play("Play"); 
      ResetAnimation(animation["Play"]);
      text = "Button clicked!";
   }
}
function ResetAnimation(curAnim : AnimationState) 
{
   yield WaitForSeconds(curAnim.length);
   animation.Play("Idle");
   text = "Button NOT clicked...";
}

No need for an Update function at all.

Hi, I created several Buttons and want them to play a sound when touched on Android. No matter what I do they won’t play.
What can possibly be wrong?
@gringofx
@-hiTo-