mouse clicked on object animation c#

Hi, im trying to make a small part of my game where when the player click on the game object, the player will know that they have clicked it.

E.g When I left mouse button click on the object, the object size increases then returns back to its original size. Allowing the player to know that they have clicked that object.

Create a new “Mouse” C# script and paste it:

using UnityEngine;
using System.Collections;

class Mouse : MonoBehaviour {
	public static bool isLeftButton = false;
	public static bool isRightButton = false;
	public static bool isMiddleButton = false;

	public static bool isLeftButtonDown = false;
	public static bool isRightButtonDown = false;
	public static bool isMiddleButtonDown = false;

	public static GameObject onLeftButtonDown;
	public static GameObject onRightButtonDown;
	public static GameObject onMiddleButtonDown;

	public static GameObject onLeftButtonUp;
	public static GameObject onRightButtonUp;
	public static GameObject onMiddleButtonUp;

	public static GameObject onLeftButton;
	public static GameObject onRightButton;
	public static GameObject onMiddleButton;

	public static GameObject onEnter;
	public static GameObject onOver;
	public static GameObject onExit;

	public static bool isMove = false;
	public static Vector3 incrementPositionInWorld;
	public static Vector3 absolutePositionInWorld;

	private Ray mouseRay;
	private RaycastHit hit;


	void Update() {
		if (Camera.main) {
			isLeftButton = Input.GetMouseButton(0);
			isRightButton = Input.GetMouseButton(1);
			isMiddleButton = Input.GetMouseButton(2);

			isLeftButtonDown = Input.GetMouseButtonDown(0);
			isRightButtonDown = Input.GetMouseButtonDown(1);
			isMiddleButtonDown = Input.GetMouseButtonDown(2);

			mouseRay = Camera.main.ScreenPointToRay( new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0f) );
			Physics.Raycast(mouseRay,out hit);
	
			Vector3 mousePos = Input.mousePosition;
			if (hit.collider) {
				mousePos.z = hit.collider.gameObject.transform.position.z - Camera.main.transform.position.z;
			}else mousePos.z = -0.05f;
			mousePos = Camera.main.ScreenToWorldPoint(mousePos);
			incrementPositionInWorld = mousePos - absolutePositionInWorld;
			if ( incrementPositionInWorld.magnitude > 0f ) isMove = true;
			else isMove = false;
			absolutePositionInWorld = mousePos;
	
	
			onExit = null;
			if ( (hit.collider && onOver != hit.collider.gameObject) || !hit.collider ) onExit = onOver;
	
	
			if ( hit.collider ) {
				if (onOver != hit.collider.gameObject) onEnter = hit.collider.gameObject;
				else onEnter = null;
				onOver = hit.collider.gameObject;
			}else {
				onEnter = null;
				onOver = null;
			}
	
	
			if ( Input.GetMouseButton(0) ) onLeftButton = onOver;
			else onLeftButton = null;

			if ( Input.GetMouseButton(1) ) onRightButton = onOver;
			else onRightButton = null;

			if ( Input.GetMouseButton(2) ) onMiddleButton = onOver;
			else onMiddleButton = null;
	
	

			if ( Input.GetMouseButtonDown(0) ) onLeftButtonDown = onOver;
			else onLeftButtonDown = null;

			if ( Input.GetMouseButtonDown(1) ) onRightButtonDown = onOver;
			else onRightButtonDown = null;

			if ( Input.GetMouseButtonDown(2) ) onMiddleButtonDown = onOver;
			else onMiddleButtonDown = null;
	
	

			if ( Input.GetMouseButtonUp(0) ) onLeftButtonUp = onOver;
			else onLeftButtonUp = null;

			if ( Input.GetMouseButtonUp(1) ) onRightButtonUp = onOver;
			else onRightButtonUp = null;

			if ( Input.GetMouseButtonUp(2) ) onMiddleButtonUp = onOver;
			else onMiddleButtonUp = null;
		}
	}
}

Attach this script to any gameObject in scene!
Now you can access it from any other C# script like this:

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {
	GameObject currentSelected;
	private Vector3 originScale;
	
	void Update () {
		if (Mouse.isLeftButtonDown) {
			print ("ok");
			if (Mouse.onLeftButtonDown!=null && Mouse.onLeftButtonDown.tag == "Selectable") {
				if (currentSelected != null) currentSelected.transform.localScale = originScale;
				currentSelected = Mouse.onLeftButtonDown;
				originScale = currentSelected.transform.localScale;
				currentSelected.transform.localScale *= 1.5f;
				Debug.Log("You Select: " + currentSelected);
			}else {
				if (currentSelected != null) currentSelected.transform.localScale = originScale;
				currentSelected = null;
			}
		}
	}
}