Raycast problem

I’m using a raycast and the raycast shot next to the object detects collisions and the raycast shot above doesn’t detect collisions.

        Ray ray = new Ray(Edge.transform.position, transform.forward);

        Debug.DrawRay(ray.origin, Edge.transform.forward * 50, Color.red);
        RaycastHit hitInfo;
        if (Physics.Raycast(ray, out hitInfo, 15, layerma))
        {
            Instantiate(Par2, hitInfo.point, Par2.transform.rotation);
        }

Be careful
You are casting a ray in forward direction and not above if you want to shoot ray along y use transform.up

your rays length is 15 but in here Debug.DrawRay(ray.origin, Edge.transform.forward * 50, Color.red);
you draw it 50 so your ray,s visual feedback is colliding but actually is not.
change the lenght and direction of your ray