linerenderer follow camera unity code example
Example 1: linerenderer follow camera unity
You can render the line using a dedicated camera. Use .depth to control the order in which cameras render (i.e. render the line on top of -everything-), and .cullingMask to define what each camera renders (or not).
http://unity3d.com/support/documentation/ScriptReference/Camera-depth.html
http://unity3d.com/support/documentation/ScriptReference/Camera-cullingMask.html
Example 2: how to use line renderer moving camera unity
You simply have to update the points in Update to new world positions each update (and not just when you create the curve).
Something along:
int i = 0;
foreach screenPosition of my curve
Vector3 worldPosition = camera.ScreenToWorldPoint(screenPosition);
lineRenderer.SetPosition(i, worldPosition);
i++;
The tricky part will be to update if you interpolate screenpositions (or worldPositions), or sample them. In either case, the slow but easy method will be to re-interpolate and resample each Update.
Once you have got this going, you can optimise by storing the the right number of points in screen space. Then you only have to convert to world space - no need to resample or reinterpolate.