I want to draw three separate lines with line renderer, but I can only see one when I run the program. How can I make all of them appear? Thanks!
enter code here`
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Keep_dist : MonoBehaviour
{
public GameObject eye;
public GameObject Pikachu;
public Vector3 a;
public Vector3 b;
public Transform obj1_s;
public Transform obj1_e;
public LineRenderer line1;
public Transform obj2_s;
public Transform obj2_e;
public LineRenderer line2;
public Transform obj3_s;
public Transform obj3_e;
public LineRenderer line3;
// Start is called before the first frame update
void Start()
{
line1 = eye.GetComponent();
line2 = eye.GetComponent();
line3 = eye.GetComponent();
}
public void MoveGameObject()
{
Pikachu.transform.position = b;
}
// Update is called once per frame
void FixedUpdate()
{
a = eye.transform.position;
b = Pikachu.transform.position;
b.x = a.x + 1;
b.y = a.y;
b.z = a.z - 3;
MoveGameObject();
//print(a.ToString());
//print(b.ToString());
line1.SetPosition(0, obj1_s.position);
line1.SetPosition(1, obj1_e.position);
line2.SetPosition(0, obj2_s.position);
line2.SetPosition(1, obj2_e.position);
line3.SetPosition(0, obj3_s.position);
line3.SetPosition(1, obj3_e.position);
}
}