Version: 2019.2
Scripting para Android
Construyendo y utilizando plug-ins para Android

Advanced Unity mobile scripting

Device properties

Hay un número de propiedades específicas al dispositivo que puedes acceder. Puedes ver las páginas de referencia de script de SystemInfo.deviceUniqueIdentifier, SystemInfo.deviceName, SystemInfo.deviceModel y SystemInfo.operatingSystem.

Anti-piracy check

To get licensing information about users and prevent piracy, Google offers a service called Google Play Application Licensing. See the Google Play Application License Verification example plug-in on the Asset Store for an example of how you can integrate this functionality into your Unity application. You can also download the plug-in source code from its GitHub repository.

Vibration support

You can trigger a vibration by calling 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. See the documentation on Handheld.StartActivityIndicator docs for examples.

Screen orientation

You can control the screen orientation of your application on both iOS 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:

Orientation Behavior
Portrait The device is in portrait mode, with the device held upright and the home button at the bottom.
PortraitUpsideDown El dispositivo está en modo portrait pero al revés, sostenido en posición vertical y con el botón home en la parte superior.
LandscapeLeft El dispositivo está en modo landscape, sostenido en posición vertical y el botón home a la derecha.
LandscapeRight El dispositivo está en modo landscape, sostenido en posición vertical y con el botón home a la izquierda.

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.

See the API documentation for Screen.autorotateToPortrait, Screen.autorotateToPortraitUpsideDown, Screen.autorotateToLandscapeLeft and Screen.autorotateToLandscapeRight for more information.

Scripting para Android
Construyendo y utilizando plug-ins para Android