FloorWater.cs 469 B

12345678910111213141516171819
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class FloorWater : MonoBehaviour {
  5. Material secondmaps;
  6. void Start () {
  7. secondmaps = GetComponent<Renderer>().material;
  8. }
  9. void Update () {
  10. Vector2 offset = secondmaps.mainTextureOffset;
  11. offset.y -= 0.01f * Time.deltaTime;
  12. secondmaps.SetTextureOffset("_MainTex",offset);
  13. // Debug.Log(secondmaps.GetTextureOffset(8));
  14. }
  15. }