Unity画线

发布时间:2019-05-02编辑:佚名阅读(2021)

1. Debug.DrawLine

scene视图中显示,参数坐标为世界坐标,无法设置材质

for (int i = 1; i < points.Length; i++)
{
    Debug.DrawLine(points[i - 1], points[i], Color.white, 5.0f);
}

2. Gizmos.DrawLine

scene视图中显示,参数为世界坐标,无法设置材质

void OnDrawGizmos()
{
    Gizmos.color = Color.white;
    Gizmos.DrawLine(new Vector3(1, 3, 0), new Vector3(0, 3, 0));
}

3. LineRenderer

scene&game视图都可见,坐标系可选,可设置材质

lr = GetComponent<LineRenderer>();
lr.startWidth = 0.05f;
lr.endWidth = 0.05f;
lr.useWorldSpace = false;
lr.positionCount = points.Length;
lr.SetPositions(points);


  关键字:Unity画线


鼓掌

0

正能量

0

0

呵呵

0


评论区