LineRenderer with several objects ?

Updated on March 27, 2017 in Answers
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
0 on March 27, 2017

How to make a render start from one object to several objects around him.

 public Transform startPoint;
 private GameObject[] ends;
 private LineRenderer _Line;
 void Start() {
 _Line = GetComponent();
 ends = GameObject.FindGameObjectsWithTag("red_cube");
 }
 void Update() {
 for(int ii = 0; ii < ends.Length; ii++) {
_Line.SetPosition(0, startPoint.position);
_Line.SetPosition(1,ends[ii].transform.position);
 }
 

example

  • Liked by
  • maxartz15
Reply