hi guys…right at the end of project ive found a huge problem , and …
ive build my project in 1366 * 768 and whole of my positions are in world space but in built project when resolution changes something change , and someobjects that were in borders of screen dissapear , so i used this code for my background ( this is a 2d game)
to rescale it with different resolution
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 * 764 / 1368 * Screen.width / Screen.height;
this.transform.localScale.x = NewObjectWidth ;
}
but because the camera aspect ratio changes in other resolutions such as 800 * 600 ,the problem of disappearing still remains , so i found a solution for this that make the objects base on resolution of cam instead of making them in world , so is there any way to instantiate objects base on the camera resolution ,
by the way ive used this code
var p : Vector3 = camera.ScreenToWorldPoint (Vector3 (100,100,-4));
Instantiate(CreateInstantiate ,p , transform.rotation) ;
but it doesnt work correctly ,the z parameter of p … and it should be connected to camera too…
sorry it was a long questions…thanx alot