Search Unity

i want plane scale changes according to device screen resolution

Discussion in 'Scripting' started by m-y, Sep 18, 2014.

  1. m-y

    m-y

    Joined:
    Sep 22, 2013
    Posts:
    472
    i want someone to correct it to me
    i want the plane size to scale to change if the screen resolution is like that
    but it is give me error
    i am trying to make the plane scale changes according to the device screen resolution
    so what i miss ?

    if ( Screen.SetResolution(640, 480, true))
    {
    planes.transform.localScale= new Vector3 (10,20,10 ) ;

    }
     
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    You don't want to do this:
    Code (CSharp):
    1. if ( Screen.SetResolution(640, 480, true))
    if ( Screen.SetResolution(640, 480, true))
    more like
    Code (CSharp):
    1. if(Screen.width == 640 && Screen.height == 480 && Screen.fullScreen)
    2. {
    3.    //DoStuff
    4. }
     
  3. m-y

    m-y

    Joined:
    Sep 22, 2013
    Posts:
    472
    this script will affect it on editor ?
    or just on android device ?
    cause i am changing it now from free aspect to the size i want
    nothing happen ! ?
     
  4. m-y

    m-y

    Joined:
    Sep 22, 2013
    Posts:
    472