Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class WaterAnimator : MonoBehaviour {
- public Vector2 speed1;
- public Vector2 speed2;
- private Renderer renderer;
- private Material material;
- // Use this for initialization
- void Start () {
- renderer = GetComponent <Renderer>();
- material = renderer.material;
- }
- // Update is called once per frame
- void Update () {
- Vector2 offset1 = new Vector2 ((Time.time * speed1.x) % 1, (Time.time * speed1.y) % 1);
- Vector2 offset2 = new Vector2 ((Time.time * speed2.x) % 1, (Time.time * speed2.y) % 1);
- material.SetTextureOffset ("_MainTex", offset1);
- material.SetTextureOffset ("_DetailAlbedoMap", offset2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement