Like you see in this video
The bottom pipes go crazy this is my script for /Pipe Init/BGloop/etc In C#
using UnityEngine;
using System.Collections;
public class BGLooper : MonoBehaviour {
int numBGPanels = 6;
float pipeMax = 11.53f;
float pipeMin = 14.2f;
void Start () {
GameObject [] pipes = GameObject.FindGameObjectsWithTag("Pipe");
foreach (GameObject pipe in pipes) {
Vector3 pos = pipe.transform.position;
pos.y = Random.Range (pipeMin, pipeMax);
pipe.transform.position = pos;
}
}
void OnTriggerEnter2D(Collider2D collider) {
Debug.Log ("Triggered:" + collider.name);
float widthofBGObject = ((BoxCollider2D)collider).size.x;
Vector3 pos = collider.transform.position;
pos.x += widthofBGObject * numBGPanels;
if (collider.tag == "Pipe") {
pos.y = Random.Range (pipeMin, pipeMax);
}
collider.transform.position = pos;
}
}