An advanced line renderer for drawing multiple connected line segments with features including bezier curves, join types (bevel/miter), and line caps.
1 Overview
3 Methods
4 Usage
6 See also
UILineRendererList is an advanced primitive that renders multiple connected line segments with customizable styling options. It extends the basic line rendering capabilities with support for:
This is a more feature-rich alternative to UILineRenderer for complex line drawings.
The properties of the UILineRendererList control are as follows:
| Property | Description |
|---|---|
| Points | List of points to draw lines between. Can be improved using the Resolution option. |
| Line Thickness | Thickness of the drawn line in pixels. |
| Relative Size | When true, points use normalized coordinates (0,0 -> 1,1) relative to the RectTransform. When false, uses screen-space coordinates. |
| Line List | When true, points are treated as pairs of disconnected lines. When false, points form a continuous path. |
| Line Caps | Whether to add end caps (circles) at the start and end of each line. |
| Bezier Segments Per Curve | Number of segments to generate per bezier curve for smoothing. Only used when Bezier Mode is not None. |
| Line Joins | The type of join between line segments: Bevel (curved) or Miter (sharp angular). |
| Bezier Mode | The type of Bezier smoothing to apply: None, Quick, Basic, Improved, or Catenary. Cannot be used with manual Resolution setting. |
| Driven Externally | When true, allows external code to drive the rendering without updating from properties. |
| Property | Return Type | Description |
|---|---|---|
| LineThickness | float | Get or set the line thickness, automatically marks for redraw. |
| RelativeSize | bool | Get or set whether points are relative or screen-space. |
| LineList | bool | Get or set whether lines are connected or as pairs. |
| LineCaps | bool | Get or set whether line caps are drawn. |
| BezierSegmentsPerCurve | int | Get or set the bezier resolution. |
| Method | Arguments | Description |
|---|---|---|
| SetAllDirty | N/A | Marks the graphic as dirty and requires a full redraw. |
| OnPopulateMesh | VertexHelper | Internal method that populates the mesh data for rendering. |
Add the UILineRendererList component to a RectTransform in your UI hierarchy:
“Add Component -> UI -> Extensions -> Primitives -> UILineRendererList”
Then configure the line points and drawing options in the inspector.
Basic usage example:
public UILineRendererList lineRenderer;
void Start()
{
// Create points for the line
List<Vector2> points = new List<Vector2>
{
Vector2.zero, // Start point
new Vector2(100, 50), // Middle point
new Vector2(200, 0) // End point
};
lineRenderer.Points = points;
lineRenderer.LineThickness = 5f;
}
To smooth line segments with Bezier interpolation:
lineRenderer.BezierMode = UILineRendererList.BezierType.Improved;
lineRenderer.BezierSegmentsPerCurve = 20;
Configure how segments connect:
lineRenderer.LineJoins = UILineRendererList.JoinType.Bevel; // Curved joins
lineRenderer.LineCaps = true; // Add end caps
Coming soon…
jack.sydorenko, firagon