var Relative : boolean ;
var Top : boolean ;
var Right : boolean ;
var X:float;
var Y:float;
var W:float;
var H:float;
function OnGUI() {
var otherScript = GetComponent(GUITexture);//将GUITexture传递过来
var thetexture = otherScript.texture;//获取GUITexture的纹理
if (Relative == true ){
if (thetexture.width > thetexture.height) {
W = Screen.width;
H = (Screen.width*thetexture.height)/thetexture.width;
} else {
W = (Screen.height*thetexture.width)/thetexture.height;
H = Screen.height;
}
} else {
W = thetexture.width ;
H = thetexture.height ;
}
if (Top == true ){
Y = Screen.height - H;
} else Y = 0 ;
if (Right == true ){
X = Screen.width -W;
} else X = 0;
otherScript.pixelInset = Rect (X,Y,W,H);
//print (otherScript.pixelInset );
}