Simple script problem?

he can i get this to screen wrap long the x to, not only the y?

#pragma strict
var wrap:Vector2;
var wrapMax:Vector2;
function Awake(){
    var wrapmin:Vector3=Camera.main.ScreenToWorldPoint(Vector3(0,0,Camera.main.transform.position.y));
    wrap=Vector3(wrapmin.x-1,wrapmin.x-0.4);
    var wrapmax:Vector3=Camera.main.ScreenToWorldPoint(Vector3(Screen.width,Screen.height,Camera.main.transform.position.y));
    wrapMax=Vector3(wrapmax.x+1,wrapmax.x+0.4);
}

function Update () {
if(transform.position.y>wrapMax.y){
       transform.position.y=wrap.y;
    }
    if(transform.position.y<wrap.y){
       transform.position.y=wrapMax.y;
    }
}

Why don’t you just add this in the update function, right before the ‘y’ wrapping?

if(transform.position.x>wrapMax.x){
   transform.position.x=wrap.x;
}
if(transform.position.x<wrap.x){
   transform.position.x=wrapMax.x;
}