2d Raycast problem from enemy to player C#

The ray seems to detect the player but only when the player is standing “in” the enemy (they arent colliding)… i want the ray to trace to the player and to stop at the platform the player is standing on so that the player isn’t “seen”. The ray is going from the enemy to the “target” aka the player. All of this is in FixedUpdate. Thanks in advance / C# newbie

    Debug.DrawRay(myTransform.position, target.position - myTransform.position, Color.red); //debug ray to see the ray
	

	RaycastHit2D hit = Physics2D.Raycast(myTransform.position, target.position - myTransform.position);//from my transform in the direction to the player as seen in the debug ray
	

		if (hit.collider.tag == "Player")//if the object that was hit goes by the name "Player" then:
		{
			Debug.Log("HIT");//write HIT
		}

	if (hit.collider.tag == "SightBreak")//if the object that was hit goes by the name "SightBreak" then:
	{
		Debug.Log("cant see!!!!!!!!!!!");//write cant see!!!!!!!!!!!!!
	}

Thanks for the comments but i managed to solve it today, rest seems to have cleared my mind up hehe… I managed to figure out that the problem was that the ray collided with it self so i solved it with layermasking. This also meant i had to define a length of the ray but i just made it the distance between the enemy and player. My FixedUpdate:

    int layerMask = 1 << 9;
	layerMask = ~layerMask;
	
	Debug.DrawRay(myTransform.position, target.position - myTransform.position, Color.red); //debug ray to see the ray
	

	RaycastHit2D hit = Physics2D.Raycast(myTransform.position, target.position - myTransform.position,Vector2.Distance(target.position, myTransform.position),layerMask);//from my transform in the direction to the player as seen in the debug ray
	
	if (hit.collider != null)//if the object that was hit goes by the name "Player" then:
	{
		Debug.Log(hit.collider.tag);//write HIT
	}

Do i delete this question now since this might not help anyone?