How to check if click mouse on object

Hi! I want to check if player click mouse on object, movie will play.
I put Input.GetMouseButton (0) function on the object but if click position is not in object,this script will run too

Please tell me how to to this and I want to know how to check mouse position in “Object area”,
I know about use Raycast to get mouse position but I don’t know how to check if my mouse position is in my object area,
how to do this?

You can use OnMouseDown or raycast check.
here is onmousedown example:

void OnMouseDown() 
   //Do something

Be sure you have collider on your object.

Make sure your object has a collider then try this

function Update () {
		if (Input.GetMouseButtonDown(0)) {
			var hit: RaycastHit;
			var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
			if (Physics.Raycast(ray, hit)) {
				if ( == "MyObjectName" )Debug.Log( "My object is clicked by mouse");