SquareDash/Assets/Scenes/BackgroundScroller.cs
kingjuulian06 c33976adf4 Jumppads
2023-11-16 21:02:53 +01:00

22 lines
466 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BackgroundScroller : MonoBehaviour
{
[Range(-1f,1f)]
public float ScrollSpeed = 0.5f;
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));
}
}