using UnityEngine; using System.Collections; public class Background : MonoBehaviour { public float speed; private float amtToMove; private Vector3 rot; // Use this for initialization void Start () { rot = new Vector3(0,1,0); } // Update is called once per frame void Update () { amtToMove=speed * Time.deltaTime; transform.Translate(Vector3.down * amtToMove,Space.World); transform.Rotate(rot*Time.deltaTime,Space.World); if(transform.rotation.y>=15) rot=new Vector3(0,-1,0); if(transform.rotation.y<=-15) rot = new Vector3(0,1,0); } }