Raycast Reflect from 3D to 2D

Please help convert this snippet to make it work on 2D ! Otherwise 3D raycast doesnt hit 2d colliders

        [SerializeField] private Player player;

        private LineRenderer lineRenderer;
        private Ray ray;
        private RaycastHit hit;
        public int numberOfReflections;
        public float maxLength;

        private void Awake()
        {
            lineRenderer = GetComponent<LineRenderer>();
        }

        void Update()
        {
          
            if (Input.GetMouseButton(0))
            {
                Vector3 currentPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                Vector3 movement = currentPosition - new Vector3(player.transform.position.x, player.transform.position.y, -10);

                //======= RAY TEST =======//
                ray = new Ray(player.transform.position, movement); 
                lineRenderer.positionCount = 1; 
                lineRenderer.SetPosition(0, player.transform.position);
                float remainingLength = maxLength;

                for(int i = 0; i < numberOfReflections; i++)
                {
                    if(Physics.Raycast(ray.origin, ray.direction, out hit, remainingLength))
                    {
                        lineRenderer.positionCount += 1; 
                        lineRenderer.SetPosition(lineRenderer.positionCount - 1, hit.point);
                        remainingLength -= Vector3.Distance(ray.origin, hit.point); 
                        ray = new Ray(hit.point, Vector3.Reflect(ray.direction, hit.normal)); 

                        if (hit.collider.tag != "Boundaries" || hit.collider.tag != "Hitable") ;
                        break;
                    }
                    else
                    {
                        lineRenderer.positionCount += 1;
                        lineRenderer.SetPosition(lineRenderer.positionCount - 1, ray.origin + ray.direction * remainingLength);
                    }
                }

                //======= RAY TEST =======//

                
            }
          
                }
            }
        }

Honestly… don’t want to be rude but this just looks like you put in zero effort.

At least you could have added how you at least tried to google “Unity 2D raycast”. → That might lead you here to solve your question: 1

Nevermind. I made it work

                ray = new Ray2D(player.transform.position, movement);
                lineRenderer.positionCount = 1;
                lineRenderer.SetPosition(0, player.transform.position);
                float remainingLength = maxLength;

                for (int i = 0; i < numberOfReflections; i++)
                {
                    if (hit = Physics2D.Raycast(ray.origin, ray.direction, remainingLength, layerMask))
                    //if (Physics.Raycast(ray.origin, ray.direction, out hit, remainingLength))
                    {
                        lineRenderer.positionCount += 1;
                        lineRenderer.SetPosition(lineRenderer.positionCount - 1, hit.point);
                        remainingLength -= Vector3.Distance(ray.origin, hit.point);
                        ray = new Ray2D(hit.point, Vector3.Reflect(ray.direction, hit.normal));

                        //if (hit.collider.tag != "Boundaries" || hit.collider.tag != "Hitable") ;
                        //break;
                    }
                    else
                    {
                        lineRenderer.positionCount += 1;
                        lineRenderer.SetPosition(lineRenderer.positionCount - 1, ray.origin + ray.direction * remainingLength);
                    }