Skip to content

Instantly share code, notes, and snippets.

@marcospgp
marcospgp / ScrollingBackground.cs
Last active August 29, 2015 14:21
Unity 2D Horizontal Sprite Scroller
using UnityEngine;
using System.Collections;
public class ScrollingBackground : MonoBehaviour {
// Here's what this script does, step by step:
// Duplicates the object
// Scrolls both at a given scrollSpeed
// When an object's full length has been scrolled, it is placed on the duplicate's original position
// Last step is repeated for both objects indefinitely