Quick answer: Godot Line2D flickering or showing brief gaps when modifying points each frame? Each set rebuilds the internal mesh; assigning multiple times per frame causes inconsistent frames.

A trail effect uses Line2D and modifies points each frame; the trail flickers as if missing segments. The mesh is being torn down and rebuilt mid-frame.

One Assign Per Frame

line2d.points = updated_points

Assign once. Multiple assignments per frame each trigger a rebuild — the next assign can run before the prior render, showing nothing.

Reuse the Array

Pass the same PackedVector2Array object — in-place updates via set — instead of reallocating. Less GC pressure, smoother rebuilds.

Consider MultiMeshInstance2D

For many similar lines, MultiMesh is faster — one mesh, many transforms. Trails, beam effects, projectile streaks fit the pattern.

Antialiasing Flag

Line2D’s antialiased flag adds extra geometry that re-rebuilds on every change. Disable it for high-frequency updates if visual quality permits.

Verifying

The line/trail looks continuous across frames with no flicker or gap. CPU profile shows one Line2D rebuild per frame, not several.

“Each points assignment rebuilds the mesh. Assign once per frame, reuse the array.”

For long trails, store points in a ring buffer and update via slice — cleaner than appending and trimming each frame.