using UnityEngine; using System.Collections;
public class UVScroller : MonoBehaviour {          public float scrollSpeedU = 0.0f;     public float scrollSpeedV = 0.0f;     public float sinUHeight = 0.0f;     public float sinVHeight = 0.0f;          void Update() {         float u = Time.time * scrollSpeedU;         float v = Time.time * scrollSpeedV;         if(sinUHeight != 0)             u = Mathf.Sin(u) * sinUHeight;         if(sinVHeight != 0)             v = Mathf.Sin(v) * sinVHeight;         Vector2 uv = new Vector2(u, v);         renderer.material.SetTextureOffset ("_MainTex", uv);    } }
|
|