Acsess shader blend slider at runtime

Hey guys,

Im using Jessy’s ‘Blend 2 Textures’ shader from the Community Wiki to blend two materials. It works great.

But now I want to chnage the blend slider at Runtime using the GUI or by setting a float value.

Im not sure how to acsess the _Blend property of Jessy’s shader.

Shader:-

Shader "Blend 2 Textures" { 

Properties {
	_Blend ("Blend", Range (0, 1) ) = 0.5 
	_MainTex ("Texture 1", 2D) = "" 
	_Texture2 ("Texture 2", 2D) = ""
}

SubShader {	
	Pass {
		SetTexture[_MainTex]
		SetTexture[_Texture2] { 
			ConstantColor (0,0,0, [_Blend]) 
			Combine texture Lerp(constant) previous
		}		
	}
} 

}

My script so far:-

    var slider : float = 1.0;
     
    function OnGUI () {
       slider = GUI.HorizontalSlider( Rect(20,135,175,30), slider, 1.0, 0);
       renderer.??? = slider;
    }

Cheers for any help.

Regards,

John

You want SetFloat, and probably “Blend” as the argument.