unity3d之在屏幕上画线

如何在屏幕上画线,简单的代码如下:

 1 using UnityEngine;
 2 
 3 public class Test : MonoBehaviour
 4 {
 5     void OnGUI()
 6     {
 7         GL.LoadOrtho();
 8         GL.Begin(GL.LINES);
 9         GL.Color(Color.red);
10         GL.Vertex3(0.1f, 0.2f, 0);
11         GL.Vertex3(0.4f, 0.6f, 0);
12         GL.Vertex3(0.2f, 0.8f, 0);
13         GL.Vertex3(0.5f, 0.9f, 0);
14         GL.End();
15     }
16 }

效果如下:

转载请注明出处: http://www.cnblogs.com/jietian331/p/5532248.html

posted @ 2016-05-26 18:37  孤独の巡礼  阅读(5609)  评论(0编辑  收藏  举报