Hi all,
Running Unity 5.2, I’m having this problem when rendering GL.Lines: all lines looks pink, and I got this error message: “Shader warning in ‘Lines/Colored Blended’: Shader is not supported. Are you creating a fixed function shader using Material(string) constructor?.”
I used to create the shader on Awake, and I could draw lines colored. But on Unity 5.2 is not working anymore.
Any ideas? Thanks!
private void Awake()
{
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;
}
}
private void OnRenderObject()
{
GL.PushMatrix();
lineMaterial.SetPass(0);
GL.Begin(GL.LINES);
GL.Color(lineColor);
GL.Vertex(A.transform.position);
GL.Vertex(B.transform.position);
GL.End();
GL.PopMatrix();
}