GL.LINES

Hey guys, this might sound silly but I just cannot make it work to draw lines using GL class. my code is here:

using UnityEngine;
using System.Collections;

public class GridGUI : MonoBehaviour {
void Start () {
}
void Update() {
GL.Begin(GL.LINES);
GL.Color(Color.red);
GL.Vertex3(0.0f,0.0f,0.0f);
GL.Vertex3(10.0f,0.0f,0.0f);
GL.End();
Debug.Log(“finished drawing”);

}
}

I also tried GL.QUADS and GL.TRIANGLES, and tried putting the GL calls in OnGUI(). None of them work :frowning: Thank you if any one can help me figure this out.
Best regards,
Sandy

Do you have Unity Pro? I don’t, and the script doesn’t give me any errors. It just skips over the GL portion and gives me the Debug.Log string.

“This class is only available in Unity Pro.”

Try commenting out the GL.End(); line. That’s probably a very bad idea (though I don’t know much about this topic), but you can at least see your line then.

Thank you so much. The line did show up after I commented GL.End(), although mine is Unity Pro…
I am still trying to find a way to solve it, but thank you anyways.

It’s got to do with the way gl drawing commands are executed. Check this for the whole story:

http://forum.unity3d.com/viewtopic.php?t=7883

/Patrik