this was my code after a long research ,,,,but unity released a new version...!
var NewObjectWidth : float ;
var OldObjectWidth : float ;
var NewObjectHeight : float ;
var OldObjectHeight : float ;
function Start ()
{
OldObjectWidth = this.transform.localScale.x ;
OldObjectHeight = this.transform.localScale.y ;
//NewObjectWidth = (OldObjectWidth /1366) * Screen.width ;
//NewObjectHeight = (OldObjectHeight/768) * Screen.height ;
//print (OldObjectWidth);
NewObjectWidth = OldObjectWidth * 768 / 1368 * Screen.width / Screen.height;
this.transform.localScale.x = NewObjectWidth ;
//this.transform.localScale.y = NewObjectHeight ;
//print (NewObjectWidth);
}
function Update ()
{
}
and this was the camera code
var ScreenHeight: int ;
var SW : int ;
function Start ()
{
SW = Screen.width ;
ScreenHeight = Screen.height ;
camera.orthographicSize = ScreenHeight/2 ;
}
function Update ()
{
}
but now everything is changed i want my background fill the screen and then other objects ....
would anyone please help me im so confused now the scale depends on pixel to unit parameter , so how can change the camera...................
↧