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.

SetResolution doesn't work on Android.

Discussion in 'Android' started by comeradealexi, Jun 8, 2016.

  1. comeradealexi

    comeradealexi

    Joined:
    Jun 25, 2013
    Posts:
    22
    EDIT: I've confirmed this is 100% a bug with 5.3.5p2 as the exact same project works in 5.3.4p4.

    Create a blank unity project. Attach a new script to the main camera with the following code in the Start() function:

    Screen.SetResolution (1280, 720, true);

    Deploy to Android device and Unity reports the following:

    Code (CSharp):
    1.  
    2. 06-08 15:12:36.267  8965  8979 D Unity   : [EGL] Using protected surface (EGL_PROTECTED_CONTENT_EXT)
    3. 06-08 15:12:36.269  8965  8979 E Unity   : [EGL] Failed to create protected window surface: EGL_BAD_ATTRIBUTE: An unrecognized attribute or attribute value was passed in the attribute list.
    4. 06-08 15:12:36.269  8965  8979 E Unity   :
    5. 06-08 15:12:36.269  8965  8979 E Unity   : (Filename: ./Runtime/GfxDevice/egl/WindowContextEGL.cpp Line: 123)
    6. 06-08 15:12:36.269  8965  8979 E Unity   :
    7. 06-08 15:12:36.272  8965  8979 D Unity   : ANativeWindow: (1920/1080) RequestedResolution: (1280/720) EGLSurface: (1280/720)
    8. 06-08 15:12:36.282  8965  8995 D Unity   : Requested framebuffer: resolution[1280x720], rgba[8/8/8/8], depth+stencil[on], samples[1]
    9. 06-08 15:12:36.282  8965  8995 D Unity   : Created framebuffer: resolution[1280x720], rgba[8/8/8/8], depth+stencil[24/8], samples[0]
    10. 06-08 15:12:36.287   235   235 E SurfaceFlinger: rejecting buffer: bufWidth=1280, bufHeight=720, front.active.{w=1920, h=1080}
    11. 06-08 15:12:36.304   235   235 E SurfaceFlinger: rejecting buffer: bufWidth=1280, bufHeight=720, front.active.{w=1920, h=1080}
    12. 06-08 15:12:36.321   235   235 E SurfaceFlinger: rejecting buffer: bufWidth=1280, bufHeight=720, front.active.{w=1920, h=1080}
    13.  
    Then nothing is rendered to screen after this.

    I'm on version 5.3.5p2.

    Any help would be greatly appreciated.

    Alex
     
    Last edited: Jun 13, 2016
  2. r-pedra

    r-pedra

    Joined:
    Dec 4, 2015
    Posts:
    104
    We used it on 5.3.4p2 to force Galaxy Tab S2 to render at full res and it worked.
    Did you tried it on multiple devices?
     
  3. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    294
    I received a report from user with LG V10, that the screen was black and nothing happened after the Unity splash. I couldn't get logs and could not reproduce it myself.

    I reduce the resolution to Full-HD on the QHD devices, such as LG V10. This problem was (at least) in 5.3.5p2 and 5.3.5p3. When I downgraded to 5.3.5f1, it worked. Might be related, but might not as well.

    Then again on my wifes Galaxy S6 it worked, and it is also a QHD device. My Nexus 6P I couldn't test because I managed to break it just the other day. :(
     
  4. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    294
    Could you verify with 5.3.5f1 if it works there? If it does, it's likely the same problem I had. Have you submitted a bug report?
     
  5. comeradealexi

    comeradealexi

    Joined:
    Jun 25, 2013
    Posts:
    22
    I saw a bug report where someone else had the exact same problem but I can't seem to find it anymore so I've submitted one anyway. @r.pedra, it works in 5.3.4 versions, this is specifically the latest patched version.
     
  6. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    294
    Did you try 5.3.5f1 if it works for you? It did for me, patches did not.
     
  7. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    294
    Apparently the new patch 5.3.5p4 fixes this issue:
    • (802824) - Android: Fixed the issue of game freezing when changing resolution with Screen.SetResolution.