iOS "Best Performance" Gives Odd Resolutions (Unity 4.0)?

Short Version:

In Unity 4.0, we get new resolution choices for iOS. However, I’m finding that the “Best Performance” option gives very odd resolution choices, which are NOT the pre-retina resolutions I would have expected. E.g. the iPad 3 gives 1536x1152 in best performance rather than the 1024x768 I would have expected.

Does anyone know what is up with these strange resolution choices under “Best Performance”?

Details:

I ran tests across the set of devices I had available, trying each of the provided settings. Here are the results:

Native:

  • 1136x640, iPhone 5
  • 2048x1536, iPad 3
  • 1024x768, iPad 2
  • 480x320, iPod Touch 3

Auto (Best Performance):

  • 852x480, iPhone 5
  • 1536x1152, iPad 3
  • 768x576, iPad 2
  • 360x240, iPod Touch 3

Auto (Best Quality):

  • 1136x640, iPhone 5
  • 2048x1536, iPad 3
  • 1024x768, iPad 2
  • 480x320, iPod Touch 3

768p (iPad):

  • (distorted) 1024x768, iPhone 5
  • 1024x768, iPad 3
  • 1024x768, iPad 2
  • (distorted) 1024x768, iPod Touch 3

320p (iPhone):

  • (distorted) 480x320, iPhone 5
  • (distorted) 480x320, iPad 3
  • (distorted) 480x320, iPad 2
  • 480x320, iPod Touch 3

640p (iPhone Retina):

  • (distorted) 960x640, iPhone 5
  • (distorted) 960x640, iPad 3
  • (distorted) 960x640, iPad 2
  • (down-sampled) 960x640, iPod Touch 3

Findings:

  • I gather these are all “virtual”
    resolutions, as in many cases they do
    not seem possible on the actual
    device. It’s sort of nice that Unity
    allows this.
  • As expected, “native”
    and “auto (quality)” are redundant
    for this set of devices. This isn’t
    necessarily an issue, as other
    devices may be different.
  • The “768p”,
    “320p” and “640p” options are next to
    useless when targetting multiple
    devices. Despite the descriptions, they are NOT defining only the vertical resolution, but are fixing the aspect ratio as well. The result is that “640p
    (iPhone Retina)” is distorted on a
    retina iPhone 5 or any other device
    of a different proportion than the
    older retina iPhones. A really questionable choice to include these given Unity’s supposed “build once, deploy everywhere” philosophy.

The thing which really throws me, though, is the set of “best performance” resolutions. Although they are all the correct proportions, I would have expected to get the standard non-retina resolutions here (e.g. 1024x768 for iPad 3), but instead we see some in-between resolution. Surely the lower-res option would be better for performance, so why not choose it? In fact, with the choices available, it is not possible to get both 1024x768 on an iPad 3 and 480x320 on an iPhone 4 with the same build settings — a desirable configuration for apps with intense visuals.

Am I missing a technical reason for this? Is it a bug or oversight of some sort?

Dude you can change this in Xcode. From Unity, set Target Resolution to Best Performance, then in Xcode open AppController.mm and scroll down to here:

SetupTargetResolution(EAGLSurfaceDesc* surface)
{
    // while this may look stupid, we call that function from inside unity render loop
    // so dont fiddle with resoltion right away, but postpone till the end of the frame
    int targetRes = UnityGetTargetResolution();

    float resMult = 1.0f;
    if(targetRes == kTargetResolutionAutoPerformance)
    {
        switch(UnityGetDeviceGeneration())
        {
            case deviceiPhone4:     resMult = 0.26f;     break;
            case deviceiPad1Gen:    resMult = 0.5f;     break;
            case deviceiPad3Gen:    resMult = 0.5f;     break;

            default:                resMult = 1.0f;
        }
    }

Now you can change the resolution as you see fit!

Since this question doesn’t have an “answer” yet as such, I think I should add one in case someone else stumbles on it:

The “best performance” settings gives you a 0.75 multiple of full resolution across the board. An odd choice perhaps (why not 0.5, or a choice?), but makes math sense if not practical sense.

The “best quality” option just gives the native resolution it would appear, so it’s redundant?

The “640p” and other options imply an EXACT resolution and are ONLY useful if you are targeting that one type of screen. If you try it for varied phones or tablets with different proportions you will get distorted results. Since they are just the native resolutions of specific devices.

As for my original case: If you wanted to choose 1024x768 for both iPad 2 and iPad 3 but retina for iPad 4+, which is a common choice for performance reasons relating to the iPad 3, you need to do it manually in code.