材质贴图流动效果,把脚本挂在在要流动贴图的物体上
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FluentTex : MonoBehaviour {
private Material m;
public float moveSpeed = 0.5f;
void Start () {
m = GetComponent<Renderer>().sharedMaterial;
}
void Update () {
if (m)
{
float dir = Time.time*moveSpeed;
m.SetTextureOffset("_MainTex", new Vector2(dir, 0));
}
}
}