Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

SetResolution Screen.width not same

Discussion in 'Scripting' started by Diversity276, Mar 4, 2015.

  1. Diversity276

    Diversity276

    Joined:
    Mar 22, 2014
    Posts:
    51
    Hey guys,

    short question.
    Yesterday i found out then i can resize my android-app-game by execute following command:
    Screen.SetResolution(720, 1200);

    The problem is: if i ask Unity for Screen.Height it does not return the value of 1200 for me its return 800 which is my original resolution (480x800 Samsung Galaxy S3 Mini).


    Hope some of you can help me :)

    Best regards

    Kevin
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    http://docs.unity3d.com/ScriptReference/Screen.SetResolution.html
    2 points:
    If no matching resolution is supported, the closest one will be used.
    (can your device handle the new res)
    and
    A resolution switch does not happen immediately; it will actually happen when the current frame is finished
    (dont check screen.height until after you have switched)
     
  3. Diversity276

    Diversity276

    Joined:
    Mar 22, 2014
    Posts:
    51
    Ok thats helps me a lot thanks.


    May anyone have a second idea how to work on android for any resolution?

    Best regards.