- Home /
input touch android help
the game is very simple, I have to click with the mouse on the balls to eliminate them (and thus far it works) if I want to touch on Android as I do? I have done so but does not work:
var texBall : Texture[] = new Texture [5];
function Start(){
textureRandom();
collider.enabled = false;
}
function update(){
if((Input.touchCount==1)){ //touch
Destroy(gameObject);
gameObject.Find("Main Camera").SendMessage("aggiorna");
gameObject.Find("Main Camera").SendMessage("sound");
}
}
function textureRandom(){
while(true){ //finchè è vero esegui il ciclo
yield WaitForSeconds(1); //aspetto 1 secondo e cambio colore alla mesh
// variabile randomColor
var randomtex : int = Random.Range(0, texBall.length); //random della variabile cambiaColore
renderer.material.mainTexture= texBall[randomtex]; // lo assegno alla variabile randomColor
if( randomtex == 0) { //Se rossa
collider.enabled = true; //attivo collider
//print("collider attivo");
}
else{
collider.enabled = false; //altrimenti disattivo
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Cannot touch cloned prefabs 0 Answers
Input.GetAxis("Vertical") on touch devices. 2 Answers
Touch Input help.. 1 Answer