- Home /
Problem is not reproducible or outdated
Maximize on Play & Screen Width
I calculating the Screen Width once in a game at Start function:
float height = 2 * Camera.main.orthographicSize;
SceneWidth = height * Camera.main.aspect;
Mainly I use this value to adjust my background system on Start and Update but anyway.
If I use this "Maximize on Play" button it seems that Start and the first Update call returns not maximized Width.
I need this value to be valid on start, can this be acheived?
Answer by Diet-Chugg · Apr 09, 2015 at 05:10 PM
Your question isn't very clear, however the Screen Class may be what you are looking for: Screen Class It contains screen height and width information.
public void Start()
{
Debug.Log(Screen.width);
}
public void Update ()
{
Debug.Log(Screen.width);
}
Screen.width returns width in pixels, but in my case value is in units.
Anyway, it seems that I found what caused the problem. Its the Pixel Perfect asset I use in my project. Writed a bug report to the author and will try to fix it by myself