1、Debug.DrawLine
public class Test : MonoBehaviour
{
Vector3 end = new Vector3(10, 10, 10);
// Update is called once per frame
void Update()
{
Debug.DrawLine(Vector3.zero, end, Color.red);
}
}

2、Debug.DrawRay
void Update()
{
Debug.DrawRay(Vector3 start, Vector3 dir, Color color);
}

3、Gizmos.DrawLine:不用运行就可以直接在Scene窗口看见,白色的
private void OnDrawGizmos()
{
Gizmos.DrawLine(camera.position, point);
}

网友评论