void drawLine(node node1, node node2) { GameObject road1 = Instantiate(line1); myLine1 = road1.GetComponent <line>(); LineRenderer lineRenderer = myLine1.GetComponent <LineRenderer>(); lineRenderer.material = new Material(Shader.Find("Particles/Additive")); lineRenderer.SetColors(Color.green, Color.green); myLine1.DrawLine(new Vector3(node1.xPos, node1.yPos, 0), new Vector3(node2.xPos, node2.yPos)); }