Advanced Unity Mobile Scripting
Manual     Reference     Scripting   
Unity Manual > Getting Started with Android Development > Android Scripting > Advanced Unity Mobile Scripting

Advanced Unity Mobile Scripting

Android

Advanced iOS scripting

Determining Device Generation

Different Android devices support different functionality and widely varying performance. You should target specific devices or device families and decide which functionality should be disabled to compensate for slower devices. There are a number of device specific properties that you can access to figure out the device.

Note: Android Marketplace does some additional compatibility filtering, so you should not bother that your ARMv7 only app optimized for OGLES2 is offered to some old slow devices.

Device Properties

iPhoneSettings.uniqueIdentifierUnique device identifier.
iPhoneSettings.modelIs it iPhone or iPod Touch?
iPhoneSettings.systemNameOperating system.
SystemInfo.operatingSystemOperating system version.

Anti-Piracy Check

It is not uncommon for pirates to hack applications by removing Apple DRM protection and redistributing them for free. Unity Android comes with anti-piracy check which allows you to determine if your application was altered after it was submitted to AppStore.

You can check if your application is genuine (not-hacked) by accessing iPhoneUtils.isApplicationGenuine property. If this property returns false you're free to notify user that he is using hacked application or you can disable access to some functions of your application.

Note: iPhoneUtils.isApplicationGenuineAvailable should be used along with iPhoneUtils.isApplicationGenuine to verify that application integrity can actually be confirmed.

Note: accessing iPhoneUtils.isApplicationGenuine property is reasonably expensive operation and you should never do it on a frame-to-frame basis.

Vibration Support

You can trigger device vibration by calling iPhoneUtils.Vibrate. However devices lacking vibration hardware will just ignore this call.

Standard Assets

"Standard Assets" is a folder with special meaning (same as "Plugins" and "Editor) and its content is compiled before all other scripts. You should keep your scripts in folders without special name.

Page last updated: 2011-02-24