There are a number of device-specific properties that you can access. See the script reference pages for SystemInfo.deviceUniqueIdentifier, SystemInfo.deviceName, SystemInfo.deviceModel and SystemInfo.operatingSystem.
A common way of hacking an application is by removing the AppStore 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 AppStore.
Check if your application is genuine (not hacked) with the Application.genuine property. This is useful to alert users they are using a hacked application, or to disable certain functions, if the property returns
Note: Application.genuineCheckAvailable should be used along with
Application.genuine to verify that application integrity can be confirmed. Accessing the Application.genuine property is a resource-intensive operation and so you shouldn’t perform it during frame updates or other time-critical code.
You can trigger a vibration by calling Handheld.Vibrate. Devices without vibration hardware ignore this call.
Mobile operating systems have built-in activity indicators you can use during slow operations. See the documentation on Handheld.StartActivityIndicator docs for examples.
You can control the screen orientation of your application on both iosApple’s mobile operating system. More info
See in Glossary and Android devices. Detecting a change in orientation or forcing a specific orientation is useful for creating game behaviors that depend on how the user is holding the device.
Retrieve device orientation by accessing the Screen.orientation property. Orientation can be one of the following:
|Portrait||The device is in portrait mode, with the device held upright and the home button at the bottom.|
|PortraitUpsideDown||The device is in portrait mode but upside down, with the device held upright and the home button at the top.|
|LandscapeLeft||The device is in landscape mode, with the device held upright and the home button on the right side.|
|LandscapeRight||The device is in landscape mode, with the device held upright and the home button on the left side.|
Set Screen.orientation to one of the above orientations, or use ScreenOrientation.AutoRotation to control the screen orientation. When you enable auto-rotation, you can still disable some orientation on a case-by-case basis.
Different device generations have varied performance and support different functionalities. Use the iOS.DeviceGeneration property to query the device’s generation.
See the iPhone Hardware Guide documentation for more information about different device generations, performance, and supported functionality.
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 do not 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.
See the API documentation on Screen.cutouts for more information on using this function.
Did you find this page useful? Please give it a rating: