Search Unity

iOS developers around the world are waiting impatiently for Friday, November 2, when the new iPad4 and iPad Mini ship. The iPad4 promises improved CPU and GPU performance, meaning you can develop even more beautiful content for it. The iPad Mini introduces new physical dimensions for the screen with ~160 ppi, so it might require some minor fine-tuning of human interface design.

We are happy to announce that you can already begin designing your cool content for the new iPads with today’s release of the Unity 4 beta. The Unity 4 beta is perfectly tuned to make it easy for you to detect which device your game is running on. Both devices will also work out-of-the-box with Unity 3.5.6 and in this blog we will share a small snippet of plugin code that 3.5.6 developers can use until we update a couple of 3.5.6 APIs.

Before going straight to the code we would like to say thanks to our friends at Apple who kindly shared how iPad Mini and iPad4 can be distinguished from older iPads.

There are two main API entries in Unity that help you tune your game to specific iOS device features. They are Screen.dpi and iPhone.generation. Out of the box these will work with Unity 4.0 Open Beta, but Unity 3.5.6 runtime will detect iPad Mini as 2nd generation iPad and the iPad4 as a 3rd generation device. This will let most of the games work without any change, but as mentioned above, some of you might want a more fine-grained control on things. There comes simple iOSInfo plugin code package for Unity 3.5.6, which is not aimed to completely replace Screen.dpi and iPhone.generation APIs, but more like complement it until these changes get included into official Unity 3.5.x releases.

Installation and use instructions for Unity 3.5.6 are straightforward:

  1. Download iOSInfoPlugin_for_Unity_3_5_6.unitypackage;
  2. In Unity Editor 3.5.6 click Assets->Import Package->Custom Package.. and select just downloaded file; (Make sure all the files are selected for import)
  3. Start using the code. iOSInfo plugin offers four API entries:
    • iOSInfo.isIPadMini — this property evaluates to true when running on iPad Mini;
    • iOSInfo.isIPad4Gen — this property evaluates to true when running on 4th generation iPad;
    • iOSInfo.dpi — this property provides float number with dpi estimation for current device. It effictively can be used instead of Screen.dpi.
    • iOSInfo.GetDeviceModel() — this method provides string with raw hardware ID of the device, like iPad2,5.

Most likely your code will look like this:

or like this:

With Unity 4.0 Open Beta it is even simplier. Your code probably will look like this:

or like this:

Edit: updated iOSInfo plugin download URL, I hope this one works more reliably.

30 replies on “Unity’s ready for the iPad 4 and new iPad Mini!”

does anyone have problems unzipping the folder? I get a bunch of empty folders when i tried extracting the zipped package. I also tried just deleting the .zip extension and then importing into unity but no luck there. Unity complains about unknown format. Btw, I have a mac.

[…] Unity Technologies Blog » Blog Archive » Unity’s ready for the iPad4 and new iPad Mini! […]

In the provided C++ file, char *machine = (char *)malloc(size + 1); is never free’d. Is the C# interop smart enough to free this memory? Or should that string be static instead? I changed the cpp to avoid this.

#define MAX_DEVICE_NAME 32;
static char g_szDeviceName[MAX_DEVICE_NAME] = { 0 };

extern «C» char* GetDeviceModel() {
if (g_szDeviceName[0] == 0) {
size_t size; // get string size by passing NULL
sysctlbyname(«hw.machine», NULL, &size, NULL, 0);

//char *machine = (char *)malloc(size + 1);

sysctlbyname(«hw.machine», g_szDeviceName, &size, NULL, 0);
g_szDeviceName[size] = 0;

return g_szDeviceName;

We seem to be having issues with Unity being able to import the zip file, and if we unzip the files then we don’t really know where to put those files in our project. Can you re-upload the .zip file as a .unitypackage file, or tell us where to put the files manually? Thank you.

Why don’t add a zoom slider to let resize the player area to avoid the need of bigger screen to test on «small» monitors for new iPad/iphone 5?

@Aras Pranckevičius Thanks so much for the hard work to make Unity iOS compatible with the new Apple Products. As a iOS Pro user with a significant investment his would be my expectation.

The e-mail that I received stated : «We have been working together with Apple to make sure the Unity 4 beta is ready in time for the releases of the new iPad and iPad mini.»

Its great that you have worked with Apple to make the necessary changes for the iPAD mini and iPAD 4 but when are we going to work with Apple to update the Unity iOS Pro rendering pipeline. Its been over a year and a half since Apple introduced the iOS 5 API CVOpenGLESTextureCache. Are we working on this or has Unity abandoned Apples API enhancements in lieu of GPU/CPU hardware updates. We need Unity iOS Pro API compatible with Apple iOS’s… not just hardware. What good is a powerful CPU/GPU with antiquated Unity iOS 5 API support??

@Mantas: performance wise it should be no problem as the games runs pretty well on ipad2. I was wondering more about things looking out of place or any other issues that might come up when a user runs my game build on 3.5.6 on an ipad mini.

I’m a bit confused, Say I don’t do any of this, since my game is already in Apple QA. The new devices will report as unknown, which in my case assumes is a new device so it applies all effects and such. No aspect ratio changes like for iPhone 5, so what exactly should I be watching for? or is this just if we wish to modify the UI somehow for the smaller iPad?

Interesting, I was already wondering how this would get supported in the current version of Unity. I’m glad that even 3.5.x users are getting this candy. Some other software companies just ignore support for older versions, if there is another version coming. Thanks =)

@John: seriously? Same out of the box new iPad models support will come into Unity 3.5.7. Here we’re providing a way to achieve that in the already released version (3.5.6).

Unity 3.5 owners are now 2nd class and slumming it……interesting way to get us to pay 6k more to and the «pro» keys we already purchased. Go Unity!

Comments are closed.