How to make an object move towards the mouse pointer on click? [2D]

Total noob question:

So, the control system I’m looking at is this: The camera follows directly above the player’s character, and if the player clicks anywhere, the player’s character will move towards that position for the duration of the click. I’m very new to the 2D Unity, can anyone help me with this?

Remember that this is 2D, so “up” is the Z axis.

You are not asking for rotation, so there is no difference between 2D and 3D. This bit of sample code assumes an Orthographic camera.

#pragma strict

public var moveSpeed = 2.0;  // Units per second

function Update () {
	if (Input.GetMouseButton(0)) {
    	var targetPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    	targetPos.z = transform.position.z;
        transform.position = Vector3.MoveTowards(transform.position, targetPos, moveSpeed * Time.deltaTime);

have a look at Vector2.MoveTowards

transform.position = Vector2.MoveTowards(transform.position, Target.transform.position, Speed*Time.deltaTime);