UI Image and OnMouseDown not working

I made an UI Image as button and I use a script for click:

void Start() {

void Update() {

void OnMouseDown() {

UI Image has the script.

For UGUI UI objects, instead of OnMouseDown, use OnPointerDown:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems; // Required when using Event data.

public class ExampleClass : MonoBehaviour, IPointerDownHandler // required interface when using the OnPointerDown method.
	public void OnPointerDown (PointerEventData eventData) 
		Debug.Log (this.gameObject.name + " Was Clicked.");

Alternatively, this can also be handled in the Inspector by adding an Event Trigger component.

I was literally just experiencing this same problem. I found that if I put a Button component on it, that’ll fix it right up.

,you need a object whit a Event System component. Graphiic raycaster added to your canvas and raycast target enabled on your ui element you wanna the click

This is couple years old, I figured I would recommend adding a Box Collider, 2D or 3D to the UI GameObject, and then add a script with OnMouseDown and OnMouseUp which works perfectly.

I have a Button Click event, thou needed to disable mouse scroll when pressing a button / touch.