MIF_E31230902/Assets/Asset/Scripts/BackgroundScroller.cs

21 lines
501 B
C#

using UnityEngine;
using UnityEngine.UI;
public class scrollerbackground : MonoBehaviour
{
// Start is called once before the first execution of Update after the MonoBehaviour is created
[SerializeField] private RawImage _img;
[SerializeField] private float _x, _y;
void Start()
{
}
// Update is called once per frame
void Update()
{
_img.uvRect = new Rect(_img.uvRect.position + new Vector2(_x, _y) * Time.deltaTime, _img.uvRect.size);
}
}