I have a scene fade in / out script that I’ve used since 4.0 and has been working fine. But since 4.5 it has stopped working.
If simply draws a quad over the scene which gradually fades:
public static void DrawQuad(Material aMaterial, Color aColor, float aAlpha)
{
aColor.a = aAlpha;
aMaterial.SetPass(0);
GL.Color(aColor);
GL.PushMatrix();
GL.LoadOrtho();
GL.Begin(GL.QUADS);
GL.Vertex3(0, 0, -1);
GL.Vertex3(0, 1, -1);
GL.Vertex3(1, 1, -1);
GL.Vertex3(1, 0, -1);
GL.End();
GL.PopMatrix();
}
With a simple custom material :
fadeMaterial = new Material(“Shader "Plane/No zTest" {” +
“SubShader { Pass { " +
" Blend SrcAlpha OneMinusSrcAlpha " +
" ZWrite Off Cull Off Fog { Mode Off } " +
" BindChannels {” +
" Bind "color", color }" +
“} } }”);
No idea why but since the 4.5 upgrade this script no longer fades, just drops to black for the entire length of the transition.
Had a quick look at this. Looks dx11 related, since turning off dx11 in the player settings fixes the issue. I’ve dropped a note to our graphics team to see if they have any further info and I’ll let you know what they come back with.
I think what happens, is that calling things like GL.Color outside of GL.Begin/End is technically “undefined”. It happens to work on some platforms, but does not work on others (e.g. DX11).
Hmm. Seems not all the docs agree. Since this is proven true, all the docs should state the same thing. Just fond this while checking the other functions the script uses