Search Unity

Resolution Scaling and DPI not working at runtime?

Discussion in 'Editor & General Support' started by JesterGameCraft, Oct 10, 2018.

  1. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    Hello,

    I've been playing with the Resolution Scaling setting in the Player Settings and Resolution Scaling Fixed DPI Factor (RSFDPI) in the Quality Settings and either I'm misunderstanding how this is supposed to function or it's not working properly. By the way I'm using Unity 2017.4.10f1 and running on iOS. The ultimate goal is to be able to lower the DPI for older devices at startup so that I can get decent performance.

    I've tried various combinations after looking at documentation but they don't seem to be working at runtime. When I set the Resolution Scaling to Fixed DPI and set some value for Target DPI, then adjust the RSFDPI in the editor and run on device I see the DPI changes take effect (that is good). However if I leave RSFDPI at 1 in the editor and instead use QualitySettings.resolutionScalingFixedDPIFactor in Awake() or Startup() I don't see the setting being applied. I'm considering opening a bug but wanted to check beforehand with everyone in case I'm doing something wrong.

    Thanks for any advice. Regards
     
  2. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    Nobody is seeing this? Bump.
     
  3. AFAIK you need to set the quality level run time and not that property directly.
    https://docs.unity3d.com/ScriptReference/QualitySettings.SetQualityLevel.html

    The idea is that you set different quality levels including and excluding expensive features and then you can switch level back and forth depending on the device you're running on.

    Disclaimer: I may be wrong, I haven't done it myself yet, it's just my understanding the Quality Settings manual after reading it. And I can't check it at the moment.

    Also this is more of a Scripting question not editor.
     
    Joe-Censored likes this.
  4. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    Interesting. I'll give it a shot. Thank You. If that is the case however, what is the point of exposing QualitySettings.resolutionScalingFixedDPIFactor API at all, I wonder.
     
  5. To set the value FOR the levels. I think you can create quality levels from script.
     
    JesterGameCraft likes this.
  6. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    That would make sense. So you'd only be able to use this in Editor scripts then, and not run-time in-game scripts. I've never written any Editor plugins so don't know if that's the case, but shouldn't this API then be under UnityEditor section of the documentation. If not I then doc should at least mention that it's Editor only API. I'm not trying to give you a hard time by the way, just trying to figure out if this is a bug, or documentation change that should be made. That's all. Thanks.
     
  7. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    I've setup different Quality Levels with different scaling factor and setting the quality level at startup does indeed change the DPI quality. Thank You for your help.
     
  8. bourriquet

    bourriquet

    Joined:
    Jul 17, 2012
    Posts:
    181
    Absolutely doesn't work here on iOS. Using QualitySetting.SetQualityLevel at runtime doesn't do anything...
     
  9. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    I’m still on 2017 and it worked for me when I tried it. FYI
     
  10. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    any news on this? is not working on 2019.1 either
     
  11. UNSH

    UNSH

    Joined:
    Jul 2, 2012
    Posts:
    51
  12. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    233
    Cant you use QualitySettings.resolutionScalingFixedDPIFactor function ? and set the target DPI in the Player settings and the on Start of the scene set the factor depending on the user selected low, mid or high setting ? I have not tested it yet just wondering if someone can clear this.

    This post suggests something like that:

    https://forum.unity.com/threads/tar...ng-fixed-dpi-factor-vs-setresolution.1076789/