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…