Raycasting from camera doesn't work.

Hi!! I’m trying to send a Raycast from the position on which the finger touch the screen but until now i have failed completely :confused:
Any tips/help/NonUnityofficial documentation that you can spare with me?
It is a 2D game and the future idea is to grab a position and send a gameobject to it … like a touch-to-move kinda game. (It is not a sidescroller)
What i have now:

if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Began) 
		{
			Ray ray = Camera.main.ScreenPointToRay( Input.GetTouch(0).position );
			RaycastHit hit;
			
			if ( Physics.Raycast(ray, out hit))
			{
				Debug.Log("something is hitted");  
			}
		}

Pretty basic code but it doesn’t work … is it because it’s a 3D code on a 2D enviroment(?)

Well, you kind of answered yourself. If you’re making a 2D game you’re probably using 2D colliders, so you need a 2D raycast: Unity - Scripting API: Physics2D.Raycast

Note it’s Physics 2D .Raycast.