참고: 크로스 플랫폼 프로젝트의 경우 UNITY_ANDROID
#define 지시문을 사용하여 Android 전용 C# 코드를 조건부로 컴파일하십시오. 자세한 내용은 플랫폼별 컴파일을 참조하십시오.
앱은 Input 및 Handheld 클래스를 통해 Android 기기의 많은 기능에 액세스할 수 있습니다. 자세한 내용은 다음을 참조하십시오.
Handheld.Vibrate를 호출해서 진동을 발동시킬 수 있습니다. 진동 하드웨어가 없는 디바이스는 이 호출을 무시합니다.
모바일 OS에는 앱 작동이 느릴 때 사용할 수 있는 빌트인 작업 표시기가 들어 있습니다. 자세한 내용은 Handheld.StartActivityIndicator를 참조하십시오.
기기별 프로퍼티에 액세스하려면 다음 스크립트를 사용하십시오.
스크립트 | 기기 프로퍼티 |
---|---|
SystemInfo.deviceUniqueIdentifier | 항상 ANDROID_ID 의 md5를 반환합니다. 자세한 내용은 ANDROID_ID에 대한 Android 개발자 문서를 참조하십시오. |
SystemInfo.deviceName | 기기 이름입니다. Android 기기의 경우 Unity는 안전 시스템 설정에서 device_name 과 bluetooth_name 을 읽으려고 시도합니다. 이 문자열에 값이 없으면 Unity는 <unknown> 을 반환합니다. |
SystemInfo.deviceModel | 기기 모델을 반환합니다. 여기에는 종종 제조사 이름과 모델 번호(예: “LGE Nexus 5 또는 ”SAMSUNG-SM-G900A")가 포함됩니다. |
SystemInfo.operatingSystem | 운영체제 이름과 버전을 반환합니다. |
사용자 및 불법 복제 방지에 관한 라이선스 부여 정보를 확인할 수 있도록 Google은 Google Play 애플리케이션 라이선스 부여 서비스를 제공합니다. 이 기능을 Unity 애플리케이션에 통합하는 방법에 대한 예제는 에셋 스토어의 Google Play 애플리케이션 라이선스 확인 예제 플러그인을 참조하십시오. 또한 GitHub 저장소에서 플러그인 소스 코드를 다운로드할 수도 있습니다.
iOS 및 Android 기기 모두에서 애플리케이션의 화면 방향을 제어할 수 있습니다. 방향 변경을 감지하거나 특정 방향을 강제로 사용하도록 만들면 사용자가 기기를 잡는 방식에 따른 게임 동작을 효과적으로 구현할 수 있습니다.
Screen.orientation 프로퍼티에 액세스하여 기기 방향을 검색해서 가져올 수 있습니다. 설정할 수 있는 화면 방향은 다음과 같습니다.
방향 | 동작 |
---|---|
Portrait | 디바이스가 세워진 상태로 홈버튼이 아래쪽에 위치하는 세로 모드를 나타냅니다. |
PortraitUpsideDown | 디바이스가 세워진 상태로 홈버튼이 위쪽에 위치하는 뒤집어진 세로 모드를 나타냅니다. |
LandscapeLeft | 디바이스가 세워진 상태로 홈버튼이 오른쪽에 위치하는 가로 모드를 나타냅니다. |
LandscapeRight | 디바이스가 세워진 상태에서 홈 버튼이 왼쪽에 있는 가로 모드입니다. |
Screen.orientation을 위 방향 중 하나로 설정하거나, ScreenOrientation.AutoRotation을 사용하여 화면 방향을 제어하십시오. 자동 회전을 활성화해도 각 상황에 따라 일부 방향을 비활성화할 수 있습니다.
자동 회전을 제어하려면 다음 스크립트를 사용하십시오.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.