Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. public static LineRenderer CreateLine(Vector3[] points, Color color, float width, GameObject source = null)
  2.     {
  3.         if (source == null)
  4.         {
  5.             source = new GameObject("Connection");
  6.         }
  7.  
  8.         LineRenderer line = source.AddComponent<LineRenderer>();
  9.         line.positionCount = points.Length;
  10.         for (int i=0; i<points.Length; i++)
  11.         {
  12.             line.SetPosition(i, points[i]);
  13.         }
  14.         line.material = Resources.Load<Material>("Models/Materials/LineColor");
  15.         line.startColor = color;
  16.         line.endColor = color;
  17.         line.startWidth = width;
  18.         line.endWidth = width;
  19.         return line;
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement