paint lines without making an object

Hi All,
I’m trying to paint lines to draw a distance between to nodes. My problem is that those lines are created using lineRenderer as an object. So I have to create and erase them to update their position, at the same time they are created dynamically, if only two nodes are close only one line is painted but if 1000 nodes are close then 500 lines are created.
How to do this in a simple way without adding the object in unity engine? for example in OpenGL you just draw a line using a vertex with both positions and they are not really expensive. It is clear the question?

Thanks for the help
David

public void PaintDistance ()
        {      
                foreach (Transform child in transform) {
                        if (child.gameObject.name.Length > 5) {
                                if (child.gameObject.name == "distanceLine")   
                                        Destroy (child.gameObject);
                        }
                }
                for (int i = 1; i < gm.nodeCount; i++) {
                        for (int j = i+1; j < gm.nodeCount; j++) {
                                if (gm.Nodes [i] != gm.Nodes [j]) {               
                                        Vector3 force = gm.Nodes [i].newPosition - gm.Nodes [j].newPosition;      
                                        float distance = force.magnitude;
                                        if (distance < 10.0f) {
                                                LineRenderer d_line = new GameObject ("distanceLine").AddComponent ("LineRenderer") as LineRenderer;
                                                d_line.renderer.castShadows = true;
                                                d_line.renderer.receiveShadows = true;
                                                d_line.transform.parent = gameObject.transform;
                                                d_line.transform.localPosition = Vector3.zero;
                                                d_line.material = new Material (Shader.Find ("Particles/Alpha Blended"));
                                                d_line.SetWidth (0.1f, 0.1f);
                                                d_line.useWorldSpace = true;
                                                d_line.SetColors (c2, c2);
                                                d_line.SetVertexCount (2);
                                                d_line.SetPosition (0, gm.Nodes [i].newPosition);
                                                d_line.SetPosition (1, gm.Nodes [j].newPosition);
                                        }
                                }
                        }
                }
        }

do the nodes have references to the ones they are connected to? (i.e. graph) are they just “points in space”? If they do you could attach the line renderer component to the nodes rather than have it on unattached gameobjects.

If not, you’ll need something to control them, for example a class which takes a “startNode” an “endNode” and rendered the line between the two position points. The nodes then can have a reference to that class which they tell to “update” when the nodes change.

… erm, no… you can just change their point positions with SetPosition: create once, update positions as needed

ok, so how can i attach the line to the node? do you have a link to this info?
Thanks