using UnityEngine; public class SimpleLineRender : MonoBehaviour { private LineRenderer line; public Transform player; public Transform target; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { line = gameObject.GetComponent(); line.positionCount = 2; } // Update is called once per frame void Update() { if(target == null) { Destroy(gameObject); } line.SetPosition(0, player.position); line.SetPosition(1, target.position); } }