using UnityEngine;
///
/// 生成地线
///
public class DrawGroundLine : MonoBehaviour
{
private LineRenderer line;
///
/// 地线端点
///
public Transform left, right;
public Material material;
// Start is called before the first frame update
void Start()
{
Draw();
}
// Update is called once per frame
void Update()
{
line.SetPosition(0, left.position);
line.SetPosition(1, right.position);
}
public void Draw()
{
line = gameObject.AddComponent();
line.material = material;
line.material.color = Color.white;
line.positionCount = 2;
//line.SetWidth(0.005f, 0.005f);
line.startWidth = 0.005f;
line.endWidth = 0.005f;
}
}