Level One Magic
"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke
UVScroller.cs
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);
   }
}

Back to Main

© 2003-2013 Andrew Kelts