function Update () {
hit = Physics2D.Raycast(camera.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
for(var i : int = 0; i < Input.touchCount; i++) {
var touch : Touch = Input.GetTouch(i);
if(Input.GetTouch(i).phase == TouchPhase.Began){
if( hit != null && hit.collider.gameObject.name == "Right"){
Right.GetComponent(SpriteRenderer).sprite = afterRight;
bool = true;
}
if( hit != null && hit.collider.gameObject.name == "Left"){
Left.GetComponent(SpriteRenderer).sprite = afterLeft;
bool2 = true;
}
}
}
}
for some reason this code isn’t working with multitouch. Its a code for the arrow buttons to control the character. But I want to be able to touch 2 buttons at a time- for example to touch both the right button and the jump button. But it would only allow me to touch one. Whats wrong with my code?!?! Btw this code is attached to the camera.