- Home /
Touch Button Android
I put this script in the Button and Cube to Play the Cube animation when the button be touched, is a touch button script. What is Wrong, is not working!
var btnTexture : Texture; function OnGUI() {
if (!btnTexture) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
if (GUI.Button(Rect(10,10,50,50),btnTexture))
Debug.Log("Clicked the button with an image");
animation["Play"].speed= 1.0;
animation.Play("Play");
} function ResetAnimation(curAnim : AnimationState) {
yield WaitForSeconds(curAnim.length);
animation.Play("Idle");
}
PLay.jpg
(56.2 kB)
Comment
What are you trying to do with your cube? You need to be moreSpecific for us to help you? If you looking for simple up and down movement on button touch, that can be hard coded very easily?
Your answer
Follow this Question
Related Questions
Button reaction time problem 1 Answer
Android GUITexture Touch 0 Answers
Create GUItexture Touch Button 1 Answer
Problem with touch button (when moved) 2 Answers
how use specific for mobile button when we have 3 ? 1 Answer