Inconsistent behaviours in UI between polyline component and equivalent immediate drawing
Heya! 🌸
As discussed on the server, there are some inconsistencies between the polyline component and its immediate drawing equivalent when used for UI.
Reproduction steps
To reproduce the following observations:
- Add a Canvas to your scene
 - Set its render mode to Screen Space - Camera
 - Add a child Game Object to the Canvas with the polyline component

 - Add a child GameObject to the Canvas with a custom polyline script that uses the local matrix and the same inner parameters. Example:
 
using Shapes;
using UnityEngine;
using ScaleMode = Shapes.ScaleMode;
public class ImmediatePolyline : MonoBehaviour {
    private PolylinePath p;
    private void Awake() {
        Draw.LineThicknessSpace = ThicknessSpace.Meters;
        Draw.LineGeometry = LineGeometry.Flat2D;
        Draw.BlendMode = ShapesBlendMode.Transparent;
        Draw.ScaleMode = ScaleMode.Uniform;
        Draw.PolylineJoins = PolylineJoins.Miter;
        p = new PolylinePath();
        p.AddPoint(new Vector2(-100, -100f));
        p.AddPoint(new Vector2(100, 100f));
    }
    private void OnEnable() => OnPostRenderSubscribe();
    private void OnDisable() => OnPostRenderUnsubscribe();
    private void DrawShapes(Camera cam) {
        Draw.Matrix = transform.localToWorldMatrix;
        Draw.Polyline(p, false,5f, Color.white);
        
        Draw.ResetMatrix();
    }
    private void OnPostRenderSubscribe() {
        Camera.onPostRender += DrawShapes;
    }
    private void OnPostRenderUnsubscribe() {
        Camera.onPostRender -= DrawShapes;
    }
    private void OnDestroy() {
        p.Dispose();
    }
}
Additional notes:
- It works correctly outside UI
 - I managed to reproduce it with and without URP
 
Observations
Differences in thickness
The polyline drawn through immediate drawing:

The polyline drawn with the Polyline component:

Differences in scaling
The immediate-drawn polyline with 0.2 and 3 x-scale:


The component polyline with 0.2 and 3 x-scale:


The immediate-drawn polyline's thickness is unaffected by scale changes (while the component polyline's thickness is only affected by scale inferior to 1), also the end caps are oriented differently as a result of the change in scale, see the difference at 3 x-scale:

Flat2D Immediate Drawing Polyline tries facing the camera
Same setup from the front:

From the side:

---
Hope this was clear enough! Have a nice day ✨