Projext/Assets/Z ! M.O.B.A Environment Art Pack 2.0/Scripts/UVScroll.cs
2026-01-29 15:58:38 +09:00

25 lines
586 B
C#

using UnityEngine;
using System.Collections;
public class UVScroll : MonoBehaviour {
public float SpeedX;
public float SpeedY;
public float Direction;
private Material material;
private float deltX;
private float deltY;
void Start () {
material = GetComponent<Renderer>().material;
}
void Update () {
if (material)
{
deltX += SpeedX * Time.deltaTime * Direction;
deltY += SpeedY * Time.deltaTime * Direction;
material.SetTextureOffset("_MainTex", new Vector2(deltX, deltY));
}
}
}