Problem with touch detection


I’m using the function OnMouseDown() to detect when the object has been touched and destroy it, My code is:

void OnMouseDown(){
    	GetComponent<AudioSource> ().Play ();
    	NotificationCenter.DefaultCenter().PostNotification(this, "addScore", myPoints);
    	Invoke ("destroyBall", 0.1f);
    void destroyBall(){
    	Destroy (this.gameObject);

The code works in the computer, but when I test it in my phone, sometimes works, and sometimes doesn’t work. I test in anothers devices and it’s the same.

Any idea?

I finally solved the problem. The cause was the Unity’s physics engine. I used the gravity to move the object, but If I use the variable “velocity” fron Rigidbody2D, the game works well.