Dynamically Repeat plane to possible infinity

I am creating a 2D game and in order to create a good sense of movement I am using an image projected on a plane that acts as a backdrop. However, the game could go on for an infinite amount of time as it is a flying-side-scroller, thus I need the backdrop to repeat to infinity dynamically. Now obviously I cant just tell the computer to repeat it to infinity in the onStart() as this would crash everything, so I need to do it dynamically. This means I need to repeat it as the user nears the edge of the plane. I have several attempts but the plane always spawns in the wrong place and I can not figure it out.
A skybox will not work as it does not create the sense of movement I need.

Thanks for reading. Hope it wasn’t a book!

------------------------Code-------------------

``````var planeWidth: int;
var plane : Transform;
var player : Transform;
var middle : Transform;
var right : Transform;
function Update () {
Debug.DrawRay(Vector3(player.position.x,player.position.y,player.position.z), Vector3(plane.position.x + (1500), plane.position.y,plane.position.z), Color.blue);
//1500 is the plane width?? I dont know was a shot in the dark.

if(Physics.Raycast(Vector3(player.position.x,player.position.y,player.position.z), Vector3(plane.position.x + (1500), plane.position.y,plane.position.z),100)){

Debug.Log("Something in the way :)");

//ray cast tells me if the plane is still there. Raycast at an angle so the user never sees the end of the plane and the new plane is there before the user hits that position.

}else{
//spawn the plane

Debug.Log("Need to draw new backdrop");

planeWidth = Vector3.Distance(middle.position, right.position);
//get the width of the plane. two empties in the middle and right and get the distance between them, there is where the plane needs be spawned.

Instantiate(plane, Vector3 (plane.position.x + planeWidth, plane.position.y, plane.position.z), Quaternion.identity);

//should work unless I missed something stupid, or am way off track lol. Thanks guys!
}
}
``````