using UnityEngine;
//This script controls the scrolling of the background
public class Background : MonoBehaviour
{
public float speed = 0.1f; //Speed of the scrolling
void Update ()
{
//Keep looping between 0 and 1
float x = Mathf.Repeat (Time.time * speed, 1);
//Create the offset
Vector2 offset = new Vector3 (0, x);
//Apply the offset to the material
GetComponent<Renderer>().sharedMaterial.SetTextureOffset ("_MainTex", offset);
}
}
This allows my background to scroll vertically, but I’m trying to make it scroll horizontal. I tried changing the vectors, but it didn’t do anything. Any help?