Using Unityengine;
Using System.Collections;
public class Scrollbehaviour:monobehaviour
{
public int materialindex;
public string texturename = "_maintex";
Public Vector2 uvanimationrate = new Vector2 (1f, 0f);
Private Vector2 uvoffset = Vector2.zero;
Private Material Mat;
Private Color col;
private float colorahpha=0;
private void Start ()
{
col = new Color (0.54f,0.45f,0.25f, Colorahpha);
Mat = gameobject.transform.getcomponent<renderer> (). Material;
}
private void Lateupdate ()
{
if (Colorahpha <= 0.45f)
{
Colorahpha = Colorahpha + 0.001f;
COL.A = Colorahpha;
Mat. SetColor ("_tintcolor", col);
}
Uvoffset + = (VECTOR2) (uvanimationrate * time.deltatime);
if (base. Getcomponent<renderer> (). Enabled)
{
Base. Getcomponent<renderer> (). Materials[materialindex]. Settextureoffset (TextureName, Uvoffset);
}
}
}
Material gradient appearance and UV movement