Version: Unity 6.7 Alpha (6000.7)
Language : English
Device features and behavior on iOS
Screen orientation on iOS

iOS device properties and hardware features

You can access iOS device properties and hardware features, such as vibration and display cutouts, from a script. Most features of the iOS devices are exposed through the Input and Handheld classes. For cross-platform projects, Unity defines UNITY_IPHONE for conditional compilation of iOS-specific C# code.

Device properties

You can access the following device-specific properties:

Device generation

Different device generations have varied performance and support different functionalities. Use the iOS.DeviceGeneration property to query the device’s generation.

Trigger a vibration

To trigger a vibration, call Handheld.Vibrate. Devices without vibration hardware ignore this call.

Activity indicator

Mobile operating systems have built-in activity indicators you can use during slow operations. For examples, refer to Handheld.StartActivityIndicator.

Display cutout

On some displays, certain areas of the screen might be obscured or non-functional because of other hardware occupying that space. Use Screen.cutouts to return a list of bounding boxes surrounding each cutout.

iOS devices don’t provide a native API to get the display cutout information, so the cutouts are hardcoded in the Xcode project for each available iOS device. You can modify existing data or add additional devices in the Unity Xcode project ReportSafeAreaChangeForView function, which is in the UnityView.mm file.

Anti-piracy check

A common way of hacking an application is by removing the App Store DRM protection and then redistributing it for free. Use Unity’s anti-piracy check to find out if your application was altered after it was submitted to the App Store.

Check if your application is genuine (not hacked) with the Application.genuine property. If the property returns false, you can warn users they are using a hacked app, or you can disable certain functions.

Note: Use Application.genuineCheckAvailable along with Application.genuine to verify application integrity. Because accessing the Application.genuine property is a resource-intensive operation, you shouldn’t perform it during frame updates or other time-critical code.

Additional resources

Device features and behavior on iOS
Screen orientation on iOS