SquareDash/Assets/Scripts/BackgroundScroller.cs
2023-12-29 04:58:02 +01:00

23 lines
469 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BackgroundScroller : MonoBehaviour
{
[Range(-1f,1f)]
public float ScrollSpeed = 1f;
private float offset;
private Material mat;
void Start()
{
mat = GetComponent<Renderer>().material;
}
void Update() {
offset += (Time.deltaTime * ScrollSpeed) / 10f;
mat.SetTextureOffset("_MainTex", new Vector2(offset, 0));
}
}