Set target resolution per Device

Hi,

I’m searching for a way to set target resolution to ‘best performance’ only on iphone 4 and some Ipad Versions.
The only ways I have found on the internet are: using IphoneGeneration. But that seems to be deprecated. Or editing the AppController.mm in xcode. But I don’t understand how.

Is anyone familiar with how this should be handled.

Regards

using IphoneGeneration. But that seems to be deprecated.
did you read the whole message? it was moved to a proper place (and called properly)
Unity - Scripting API: iOS.Device.generation

ahaaa :slight_smile:

Thank you, did not seem to find that! :stuck_out_tongue: … I did however fixed it overnight by editing Devicesettings.mm (instead of AppController.mm) in Xcode, and that fixed everything :). Very easy to set a multiplication of the Resolution!
Thank you anyway.

Here is a pure script way of doing this. I use the awake function on a script attached to the camera, but you could stick it on any object I suppose.

I wanted my cut scene to be full res on these devices because the cut scenes in my case are not GPU intensive but looked horrible in “performance mode”.

The code has two parts, one that sets a few variables (scaledWidth, and scaledHeight). On change scene function I set the the width and height to their scaled variants, you can just change the last line in the awake function to scaledWidth and scaledHeight and remove the LoadScene function if you aren’t using a full res cut scene.

    int scaledWidth = -1;
    int scaledHeight = -1;

    void Awake() {


        if (SystemInfo.deviceType == DeviceType.Handheld) {


            int devWidth = Display.main.systemWidth;
            int devHeight = Display.main.systemHeight;

            Debug.Log ( "devwidth=" + devWidth + " devheight=" + devHeight );
            Debug.Log ( "width=" + Screen.width + " height=" + Screen.height );

            // the scaled resolution, we want to remember this because
            // when we need to set it back for performance just as we swap scenes
            scaledWidth = devWidth;
            scaledHeight = devHeight;

            switch (UnityEngine.iOS.Device.generation) {

                case UnityEngine.iOS.DeviceGeneration.iPadMini1Gen :
                case UnityEngine.iOS.DeviceGeneration.iPad2Gen :

                    Debug.Log ( "gen 2 ipad" );

                    scaledWidth = 600;
                    scaledHeight = 800;

                    break;

                case UnityEngine.iOS.DeviceGeneration.iPadMini2Gen :
                case UnityEngine.iOS.DeviceGeneration.iPad3Gen :
                   
                    Debug.Log ( "gen 3 ipad" );
                   
                    scaledWidth = 1200;
                    scaledHeight = 1600;
                   
                    break;

                // add more cases as needed.

            }
               
            Screen.SetResolution ( devWidth, devHeight, true);

        }

    }

    // note in practice you want to do this after you fade the
    // scene out to black or some other color because the
    // change in resolution is ugly.
    void LoadScene () {

        Application.LoadLevel ("some_scene");
        Debug.Log ("done");

        if (scaledWidth != -1)
                Screen.SetResolution ( scaledWidth, scaledHeight, true);


    }