- Home /
pixel in unit in unity3d and have a full screen texture
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...................
Answer by ham · Jan 13, 2014 at 08:12 PM
oah my god , i dont beleave but it seems that i found the answer here http://www.raywenderlich.com/61532/unity-2d-tutorial-getting-started
Your answer
Follow this Question
Related Questions
How to letterbox the screen and have pixel perfection in a 2d game 0 Answers
How to retain absolute gameobject size in pixels no matter the resolution? 2 Answers
How to maintain high resolution custom background images for GUI elements on different screen sizes? 0 Answers
Pick sensible resolution for FullScreen Mac App 2 Answers
Screen.SetResolution doesn't work when the game starts windowed? 0 Answers