- Home /
Touch Button for 4 animation
I have 3 animations, all of them happend at the same time. I have to put the script in all 3 animations in order to work. I need a touch button to play to 3 animations, the problem is that this script play the 3 animations, touching on the whole screen. I need to play the animation just in a GUITexture that I have, not the whole screen. How can I fix that?
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"); }
Answer by XIKO · Jun 26, 2012 at 02:21 PM
You need var to guitexture... see:
var gui : GUITexture; .................................... { if(touch.phase == TouchPhase.Began && gui.HitTest(Input.GetTouch(0).position)) { animation.Play("ANIMATION_01");
} ................................
Answer by XIKO · Jun 26, 2012 at 02:40 PM
You need var to guitexture... see:
var gui : GUITexture; .................................... { if(touch.phase == TouchPhase.Began && gui.HitTest(Input.GetTouch(0).position)) { animation.Play("ANIMATION_01");
} ................................
Your answer
Follow this Question
Related Questions
Android touch and drag GUItexture problem 0 Answers
Android Touch Input GUITexture 2 Answers
Move guiTexture along touch position 0 Answers
GUITexture touch play animation 0 Answers
GUITexture Touch Problem 2 Answers