Raycasting in 2D (C#)

I started developing with the new Unity two days ago and simply copied my old script to the new version but I got an annoying error after making it 2D.

void OnMouseDown(){
	RaycastHit2D hit;
	if (Physics2D.Raycast(transform.position, Vector2.zero, out hit)){ //Error line
		Debug.Log ("Hit");

The error is:
-error CS1502: The best overloaded method match for `UnityEngine.Physics2D.Raycast(UnityEngine.Vector2, UnityEngine.Vector2, float)’ has some invalid arguments


-error CS1615: Argument #3' does not require out’ modifier. Consider removing `out’ modifier

I tried to remove the ‘out’ even when I knew C# requires it and it didn’t work… so what’s wrong with this?

Physics.Raycast() has a very different signature to Physics2D.Raycast().

If you read these docs you will find the errors you are seeing are correct.