i have this script, and works great except i want solid white line material. i tried to use it without the material but i get strange results, grid lines in the editor view start changing?
how to get solid white line is the question, and is it reliable to use this method?
static var lineMaterial : Material;
static function CreateLineMaterial()
{
if( !lineMaterial ) {
lineMaterial = new Material( "Shader \"Lines/Colored Blended\" {" +
"SubShader { Pass { " +
" Blend SrcAlpha OneMinusSrcAlpha " +
" ZWrite Off Cull Off Fog { Mode Off } " +
" BindChannels {" +
" Bind \"vertex\", vertex Bind \"color\", color }" +
"} } }" );
lineMaterial.hideFlags = HideFlags.HideAndDontSave;
lineMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
}
}
function OnPostRender()
{
CreateLineMaterial();
lineMaterial.SetPass( 0 );
GL.Begin( GL.LINES );
GL.Color( Color(1,1,1,0.5) );
GL.Vertex3( 0, 0, 0 );
GL.Vertex3( 1, 0, 0 );
GL.Vertex3( 0, 1, 0 );
GL.Vertex3( 1, 1, 0 );
GL.Color( Color(0,0,0,0.5) );
GL.Vertex3( 0, 0, 0 );
GL.Vertex3( 0, 1, 0 );
GL.Vertex3( 1, 0, 0 );
GL.Vertex3( 1, 1, 0 );
GL.End();
}