Quick answer: The default LineRenderer material uses the built-in Sprites/Default shader, which URP ignores and renders pink. Assign a material using Universal Render Pipeline/Unlit or Particles/Unlit, and make sure the shader is in the Always Included list for builds.

Here is how to fix Unity LineRenderer not visible in URP. You add a LineRenderer, set two positions, set the width, and hit play. Instead of a line you see either nothing or a pink line cutting through your scene. The component is configured correctly, the positions are in the right place, but the shader is broken. This happens because Unity’s default LineRenderer material ships with a shader from the built-in render pipeline that URP does not support, and nothing in the UI tells you this is wrong until you look closely.

The Symptom

A newly-added LineRenderer either renders bright pink (URP’s “missing shader” color) or does not render at all. Scene gizmos show the correct positions. The Inspector shows a valid material assigned. Switching to a Built-in Render Pipeline project renders the same LineRenderer correctly, confirming the issue is URP-specific.

Variants: line renders correctly in editor but is invisible in build, line renders for the first few frames then disappears, or only part of the line renders (start but not end).

What Causes This

Default material uses a built-in shader. When you add a LineRenderer component, Unity auto-assigns a material called Default-Line that uses Sprites/Default. In URP, Sprites/Default is not a valid shader — URP’s 2D sprites go through a different shader path. URP renders the line with its error shader, which is pink.

Custom material with wrong shader. If you created a custom material for your LineRenderer, it might use Standard, Mobile/Particles/Additive, or any other built-in shader. URP only knows Universal Render Pipeline/* shaders; anything else renders as error.

Shader stripped from build. If you use a URP shader in the editor but the build strips it, the build shows pink lines. URP has aggressive shader variant stripping to keep build size down, and LineRenderer materials can fall outside the normal scan path because they are assigned through script or via materials that are not directly attached to mesh renderers.

Order in the queue. If your line uses a transparent shader and renders behind opaque geometry, you see the opaque object covering the line. This is not invisible per se, just occluded. The fix is either to use an unlit opaque shader for lines or to set renderQueue to render after opaque geometry.

The Fix

Step 1: Create a URP-compatible material. In the Project window, right-click and choose Create > Material. Name it M_Line. In the Inspector, set Shader to Universal Render Pipeline/Unlit. Set Base Map color to white (or your line color), disable any complex features you do not need.

// Assign at runtime
using UnityEngine;

public class LineSetup : MonoBehaviour
{
    [SerializeField] private Material lineMaterial;

    void Start()
    {
        var line = GetComponent<LineRenderer>();
        line.material = lineMaterial;
        line.startColor = Color.white;
        line.endColor = Color.white;
        line.startWidth = 0.1f;
        line.endWidth = 0.1f;
    }
}

Assign the material in the Inspector before entering play mode. If the pink disappears, the material swap was the fix.

Step 2: Use the correct shader for your line type. Pick based on what you need:

Step 3: Add to Always Included Shaders for builds. Open Edit > Project Settings > Graphics. In the Always Included Shaders list, click the plus icon and add your URP line shader. This guarantees it ships in every build variant regardless of which materials reference it.

Alternatively, create a preloaded ShaderVariantCollection from the Graphics Settings “Save to asset” button after playing through scenes that use your LineRenderers. Unity will collect the variants actually used and ensure they are built.

Step 4: Set render queue if the line is occluded. If the line is invisible because opaque geometry renders over it, set the material’s render queue to a higher value or use an unlit opaque shader that renders at the normal opaque queue.

// Force line to render on top of everything
lineMaterial.renderQueue = 4000;

Render queue 4000 is past the transparent queue, so the line draws last. Use sparingly — overusing this produces incorrect blending with other transparent objects.

Setting Colors Correctly

LineRenderer has its own startColor, endColor, and colorGradient properties that tint the line independently of the material color. If your line is still the wrong color after material fix, check these properties. A common bug: setting the material color to red but leaving startColor and endColor as white results in white lines because LineRenderer multiplies per-vertex colors with the material.

// Consistent red line
line.material.color = Color.red;
line.startColor = Color.white; // Don't tint the material color
line.endColor = Color.white;

2D Games with URP

If you are using URP 2D Renderer, the above still applies but your sprite renderers use a different shader path. LineRenderers do not participate in 2D lighting by default. For a line that interacts with 2D lights, use a custom Shader Graph with the 2D renderer’s lit target. Most indie 2D games do not need this — Unlit is usually correct.

“Pink is URP telling you the shader is wrong. It is never a ‘bug’ in URP; it is URP refusing to render something it cannot understand.”

Related Issues

For the general “pink materials” problem, see Unity Pink or Magenta Materials. For URP-specific build issues, URP Shader Not Rendering in Build covers related shader stripping problems.

Default-Line material is a trap in URP. Always assign a URP/Unlit material to any LineRenderer.