using System.Collections; using System.Collections.Generic; using UnityEngine; public class Line : MonoBehaviour { private LineRenderer line; public GameObject pos1; public GameObject pos2; // Use this for initialization void Start () { line = this.gameObject.AddComponent(); line.material = new Material(Shader.Find("Standard")); line.SetVertexCount(2); line.SetColors(Color.yellow, Color.yellow); line.SetWidth(0.01f, 0.01f); } // Update is called once per frame void Update () { line.SetPosition(0, pos1.transform.position); line.SetPosition(1, pos2.transform.position); } }