Unity3d Technology Android Script Advanced Unity phone script

Source: Internet
Author: User

Welcome to Unity Learning, unity training, Unity Enterprise training and education zone, there are many u3d resources, u3d training videos, u3d tutorials, U3d Frequently asked questions, U3d Project source code, we are committed to creating the industry Unity3d training, learning the first brand.

Advanced Unity phone Scripting device properties

You can access the properties of a series of specific devices:

Systeminfo.deviceuniqueidentifier The unique device identification.
Systeminfo.devicename The user-specified device name.
Systeminfo.devicemodel Device model.
Systeminfo.operatingsystem The operating system name and version.
Anti-piracy checks

This is a very common phenomenon by removing appstore DRM protection to hack applications and make them a free application. Unity is equipped with anti-piracy checks to determine if the application has been modified after submission to AppStore.

You can check whether the application is genuine (non-pirated) through the Application.genuine property. If the return value of the property is false, the user of the application can be notified that he or she is using a cracked application, or that they can be prevented from accessing certain features on the application.

Note: application.genuinecheckavailable should be used in conjunction with Application.genuine to verify that the integrity of the application is actually verified. Accessing the Application.genuine property is a fairly expensive operation and should not be used during frame updates or other code that requires strict timing.

Vibration Support

Vibrations can be triggered by calling Handheld.vibrate. However, devices that lack vibration hardware will ignore this call directly.

Activity indicator

The mobile operating system has a built-in activity indicator that you can use during slow running. See Handheld.startactivityindicator docs as a usage template.

Screen orientation

Unity ios/android allows you to control the orientation of the current screen. If you need to create game behavior that depends on how the user holds the device, then detecting direction changes or forcing some particular direction will be a very useful feature.

The device orientation can be retrieved by accessing the Screen.orientation property. The direction may be one of the following:

Portrait mode (Portrait) The device is in portrait mode, the device is placed vertically, and the home key is located below.
Portrait inversion Mode (Portraitupsidedown) The device is in portrait mode, but upside down. The device is placed upside down and the home key is above.
Horizontal left mode (landscapeleft) The device is in horizontal mode: The device is placed vertically and the home button is on the right.
Horizontal right mode (landscaperight) The device is in horizontal mode: The device is placed vertically, and the home key is on the left.

You can set the screen.orientation to one of the above modes to control the screen orientation and, if you want to rotate automatically, set it to screenorientation.autorotation. You can disable certain directions depending on the situation.

Screen.autorotatetoportrait Vertical orientation is allowed.
Screen.autorotatetoportraitupsidedown Allows vertical reversal of direction.
Screen.autorotatetolandscapeleft Allows horizontal left direction.
Screen.autorotatetolandscaperight Allows horizontal left direction.

iOS advanced iOS script determines the device's generation

Different generations of devices support different functions, the performance varies greatly. You should query the generation of devices and determine which features should be disabled to compensate for slower devices. You can view the generation of devices in the Iphone.generation property.

Android Advanced Android script determines the device's generation

Different Android devices support different features, and the performance varies greatly. You should determine the specific device or device family and decide which features should be disabled to compensate for slower devices. There are a number of specific device properties available for the devices currently in use.

Note: Android Marketplace will do some extra compatibility filtering, and you don't have to worry if you use OGLES2 optimized ARMv7 dedicated applications on some old-fashioned, slow-running devices.

For more highlights, please click http://www.gopedu.com/

Unity3d Technology Android Script Advanced Unity phone script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.