Fade Shader- One texture fades in, the other fades out

Hey Everyone,

I am trying to making a shader that contains 2 textures and colors that support transparency. I want to use a coroutine to fade between the two textures as a transition effect. I looked over the documentation and the default shaders but I couldn’t come up with anything substantial. I was wondering if you guys can help me complete my code and tell me what is wrong with it.

Shader "Custom/UnlitTransparent" {
Properties {

	_Color ("Main Color", Color) = (1,0.5,0.5,1)
	_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
	_OtherColor ("Other Color", Color) = (1,0.5,0.5,1)
	_OtherTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}

SubShader {
	Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
	LOD 100
	
	//ZWrite Off
	Blend SrcAlpha OneMinusSrcAlpha 

	Pass {
		Lighting Off
		
	    Material {
            Diffuse [_Color]
        }
		SetTexture [_MainTex] { combine texture } 
	}
	
	Pass
	{
		Lighting Off
		Blend DstAlpha OneMinusSrcAlpha 

	    Material {
            Diffuse [_OtherColor]
        }
		SetTexture [_OtherTex] {
            combine texture lerp (texture) previous
        }
	}	
	
}
}

The goal is to have the script send the shader/Material its Lerp value going from 0 to 1. The thing is, this version of Lerp uses the alpha value of the 2nd input (the one in quotes.) Since you give it (texture) it’s just doing a standard decal-blend.

So, you have to give it some fake input with the alpha set to the Lerp val you need. Can use (constant), which will use the MainColor you set. It still uses the alpha, but if you set color=new Color(1,1,1,myLerpVal) you can trick it into using your lerp val.

DISCLAIMER: I don’t use shaderLab (I use surf shaders.)

Here is a very simple example of what Owen Reynolds explained.

Shader "Custom/AlphaBlendTransition" {
Properties {
	_Blend ("Blend", Range (0, 1) ) = 0.0
	_BaseTexture ("Base Texture", 2D) = "" {}
	_OverlayTexture ("Texture 2 with alpha", 2D) = "" {}

}
SubShader {
		Pass {
			SetTexture[_BaseTexture]
			SetTexture[_OverlayTexture] {
				ConstantColor (0,0,0, [_Blend]) 
				combine texture Lerp(constant) previous
			}
		}
	}
}

This blends two textures.