- Home /
touch GUITexture Help
I need help me with my code, the touch works in the whole screen, not just in the GUItexterure.
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");
}
Go look at my Profile and the question about Android GUITextrure buttons...(I can't copy past links at work. lol) but checl it out you will find your answer if you click my user name ( it Should have 1.2$$anonymous$$ views on it)
Answer by dannyskim · May 07, 2012 at 05:41 PM
You're using the Input class, which is specifically for detecting touches on the whole screen and interacting with objects within the scene. GUITextures are not objects in the scene, they're textures rendered in a separate layer that do not behave the same as regular Game Objects.
Take a look at GUILayer and GUILayer.HitTest, this is specifically for detecting touches on GUITextures.
Your answer
Follow this Question
Related Questions
(Mobile) Touch anywhere on screen EXCEPT button 3 Answers
Holding GUI Button Touch to Rotate Object 0 Answers
Restart Game button for android mobile Phone help? 1 Answer
Onscreen fire button for FPS games. 1 Answer
Android 3D Touch for Menu 0 Answers