[Solved]how to transition between textures

Is there a way in unity to gradually fade from one texture or material to another (on a mesh)? I’m aware of renderer.material.mainTexture = newTex; but that happens instantly. I would prefer to gradually fade from one to the other over time.

Sorry to bump, but I would really appreciate an answer on this, even if its just “Unity definitely can’t do that” or “Unity should be able to do that, but it’s complicated and I can’t help”.

Blend_2_Textures here you go :wink:

Thanks! I’m not very familiar with shaders though, and I’m having trouble adjusting the Blend value through scripts. If I declare a variable of type BlendShader (which is what I called the shader in that link):

private var blendShader : BlendShader;
//private var blendShader : Shader;

function Start()
{
	blendShader = gameObject.renderer.material.shader;
	
}

function Update () 
{
	blendShader.Blend = Time.time * .1;
}

I get the error: "The name ‘BlendShader’ does not denote a valid type. "

If I declare the variable of type Shader instead of BlendShader, I get the message “‘Blend’ is not a member of ‘UnityEngine.Shader’.”

Like I said, I don’t really have any experience with shaders, so I’m probably going about this the wrong way. I looked through the manual on shaders but it only seemed to describe how to create them, but not anything about adjusting them during gameplay. Any advice is much appreciated.

You can set Shader properties within the Material

gameObject.renderer.material.SetFloat(“Blend”, VALUE);

Check out the Sets and Gets

Thanks, that got it.