multitouch

Do piano.
Touch done using the function OnMouseDown, you need to redo a multitouch.
public class buttons : MonoBehaviour
{
public AudioClip note;
void OnMouseDown()
{
{
gameObject.GetComponent().enabled = false;
GetComponent().PlayOneShot(note, 1);
}
}
void OnMouseUp()
{
{
gameObject.GetComponent().enabled = true;

}
}
}

What do you mean by “you need to redo a multitouch”? We do not need it. You need it. :smile:

I will give you an idea what to do. The code is given. Do not put it in buttons class, but create a single object with the class that contains this code:

    void Update () {
        // Code for OnMouseDown in the iPhone. Unquote to test.
        RaycastHit hit = new RaycastHit();
        for (int i = 0; i < Input.touchCount; ++i) {
            // Construct a ray from the current touch coordinates
            Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(i).position);
            if (Physics.Raycast(ray, out hit)) {
                if (Input.GetTouch(i).phase.Equals(TouchPhase.Began)) {
                   hit.transform.gameObject.SendMessage("OnMouseDown");
                }else if (Input.GetTouch(i).phase.Equals(TouchPhase.Ended)) {
                    hit.transform.gameObject.SendMessage("OnMouseUp");
                }
              }
       }
    }

Source of the code (edited a bit for your purpose)

The buttons and the class “buttons” leave as they are now.