Get OnMouseDown to work with a 2D Polygon Collider

I’m having a hell of time getting a 2D polygon collider to register a mouse click. I’ve attached images and code to show where I’m at. I cannot get the click to work. What am I doing wrong here? Need help!

using UnityEngine;
using System.Collections;

public class MouseClick : MonoBehaviour
{
	void OnMouseDown()
	{
		Debug.Log ("Clicked the Collider!");
	}
}

I’ve defined the collider:

I’ve setup the components for my image:

suggest you add the IPointerDownHandler interface to you MouseClick class: Redirect to... title of new-page

You will also need to change the format of your handler function to match this interface.

public class MouseClick : MonoBehaviour, IPointerDownHandler
{
   public void OnPointerDown(EventSystems.PointerEventData eventData);
   {
      Debug.Log ("pointer down while over the Collider!");
   }
}

There are a whole bunch of these message handling Interface type classes:
http://docs.unity3d.com/Manual/SupportedEvents.html

OnMouseDown it works perfectly :smiley: