UI Line Renderer
📏 UILineRenderer Class
A customizable UI component for rendering smooth, gradient-colored lines with variable width, rounded corners, and end caps.
Namespace:
Esper.SkillWeb.UI.UGUIInherits from:MaskableGraphicType:class
📦 Fields
private
points
List<Vector2>
List of points defining the line path.
private
lineWidth
float
Width of the line in units.
private
widthCurve
AnimationCurve
Controls width variation along the line.
private
colorGradient
Gradient
Controls color variation along the line.
private
cornerVertices
int
Number of vertices for smooth corners.
private
endCapVertices
int
Number of vertices for rounded end caps.
private
loop
bool
Whether the line forms a closed loop.
public
cachedMaterial
Material
Cached material used for rendering.
🔍 Properties
public override
material
Material
Gets or sets the rendering material.
public override
mainTexture
Texture
Gets the main texture from the current material.
public override
materialForRendering
Material
Returns a modified rendering material.
public
LineWidth
float
Gets or sets the line width.
public
WidthCurve
AnimationCurve
Gets or sets the width curve.
public
ColorGradient
Gradient
Gets or sets the color gradient.
public
CornerVertices
int
Gets or sets corner vertex count.
public
EndCapVertices
int
Gets or sets end cap vertex count.
public
Loop
bool
Gets or sets loop mode.
public
positionCount
int
Gets or sets number of line points.
🔧 Methods
public
GetCurrentMaterial()
Material
Returns the current rendering material.
protected override
OnPopulateMesh(VertexHelper vh)
void
Populates mesh with line geometry.
private
GenerateLineMesh(VertexHelper vh)
void
Builds full line mesh including segments and caps.
private
GenerateLineSegment(VertexHelper vh, Vector2 start, Vector2 end, int segmentIndex, int totalSegments)
void
Adds a quad for a line segment.
private
GenerateEndCap(VertexHelper vh, Vector2 center, Vector2 adjacent, bool isStart)
void
Adds a rounded end cap.
private
CreateVertex(Vector2 position, Color color, Vector2 uv)
UIVertex
Creates a vertex with position, color, and UV.
public
SetPosition(int index, Vector2 position)
void
Sets a point at the given index.
public
GetPosition(int index)
Vector2
Gets a point at the given index.
public
SetPositions(Vector2[] positions)
void
Sets all points from an array.
public
SetPositions(List<Vector2> positions)
void
Sets all points from a list.
public
GetPositions(Vector2[] positions)
int
Copies points into an array.
public
AddPosition(Vector2 position)
void
Adds a new point to the line.
public
RemovePosition(int index)
void
Removes a point at the given index.
public
ClearPositions()
void
Removes all points.
public
SetPosition3D(int index, Vector3 position)
void
Sets a point using a 3D vector.
public
SetPositions3D(Vector3[] positions)
void
Sets all points from a 3D array.
protected override (Editor only)
OnValidate()
void
Validates properties and forces material update.
Last updated