Quantcast
Channel: Answers for "How to draw a line using script"
Viewing all articles
Browse latest Browse all 18

Answer by paranoidray

$
0
0
void DrawLine(Vector3 start, Vector3 end, Color color, float duration = 0.2f) { GameObject myLine = new GameObject(); myLine.transform.position = start; myLine.AddComponent(); LineRenderer lr = myLine.GetComponent(); lr.material = new Material(Shader.Find("Particles/Alpha Blended Premultiply")); lr.SetColors(color, color); lr.SetWidth(0.1f, 0.1f); lr.SetPosition(0, start); lr.SetPosition(1, end); GameObject.Destroy(myLine, duration); }

Viewing all articles
Browse latest Browse all 18

Latest Images

Trending Articles





Latest Images