so, i create a gui like this…
#pragma strict
var bg : Texture;
var bg_w : float = Screen.width*0.75;
var bg_h : float = Screen.height*0.9;
var posbg_w : float= Screen.width*0.1;
var posbg_h : float= Screen.height*0.05;
var b_width:float= 420;
var b_height:float=100;
//konfigurasi button_perkalian
var button_perkalian: GUIStyle;
var pos_b1w: float = posbg_w+(bg_w*0.1);
var pos_b1h: float = posbg_h+(bg_h*0.05);
//konfigurasi button_luas
var button_luas: GUIStyle;
var pos_b2h: float = pos_b1h+100;
//konfigurasi button_satuan
var button_satuan: GUIStyle;
var pos_b3h: float = pos_b2h+100;
function Start () {
print(Screen.width);
}
function OnGUI (){
GUI.DrawTexture(Rect(posbg_w,posbg_h,bg_w,bg_h),bg);
GUI.Button(Rect(pos_b1w,pos_b1h,b_width,b_height)," ",button_perkalian);
GUI.Button(Rect(pos_b1w,pos_b2h,b_width,b_height)," ",button_luas);
GUI.Button(Rect(pos_b1w,pos_b3h,b_width,b_height)," ",button_satuan);
}
i know this code must work… but why it’s have a different value on Inspector? i print the screen.width and says it was 726… if i times it with 0.75 it will become 554, but in the inspector, it says 175.5 ! i don’t know why this is happening, anyone could explain me?