1: Bildschirmbezogene Vorgänge
Klasse: Bildschirm
Attribut:Screen.height //Bildschirmhöhe
Screen.width //Bildschirmbreite
Screen.currentResolution //Bildschirmauflösung
Screen.dpi //Bildschirm-DPI
Screen.fullScreen //Ja oder nein Vollbild
Screen.orientation //Bildschirmrotation (kann von Ihnen selbst eingestellt werden)
Screen.sleepTimeout //Die Ruhezeit des Bildschirms (unterstützt nur mobile Plattformen),
Klasse: Eingabe
Attribut:Input.touchSupported //Ob Touch unterstützt wird
Input.multiTouchEnabled //Ob Multi-Touch unterstützt wird
Input.stylusTouchSupported //Ob Striche unterstützt werden
Input.touchPressureSupported //Ob Druckempfindlichkeit unterstützt wird
Input.mousePresent //Ob die Maus unterstützt wird
Input.anyKey //Beliebige Taste gedrückt
2. Systeminformationen abrufen
Klasse: Eingabe
Attribut:Input.compass.rawVector //Elektronischen Kompass erhalten
Input.gyro.gravity //Gyroskop abrufen
Input.location.status //Standortdienst abrufen
Input.devicOrientation //Geräteausrichtung abrufen
Klasse: Anwendung
Attribut:Application.systemLanguage //Systemsprache abrufen
3. Ermitteln Sie den Status des Mobiltelefonakkus
1. Batterieinformationen 0-1 0: Kein Strom 1: Vollständig aufgeladen
Float BatteryLevel = SystemInfo.batteryLevel
2. Batteriestatus
//Unbekannter, unbekannter Status
//Laden ist Laden
//Entladen ist nicht angeschlossen oder geladen.
//NotCharging Eingesteckt, lädt nicht
//Full Der Akku ist voll
BatteryStatus BatteryStatus = SystemInfo.batteryStatus
4. System-Return-Taste
Input.GetKeyDown(KeyCode.Escape) //Der von Unity bereitgestellte Rückgabeschlüssel
Input.backButtonLeavesApp
5. Beantragen Sie die Erlaubnis, die Kamera in Unity anzurufen
Ctrip-Funktion:
IEnumerator DeviceCameraPlay()
{
//申请调用相机的权限
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
//是否拥有了权限
if(Application.HasUserAuthorization(UserAuthorzation(UserAuthorization.WebCam)))
{
//获取设备个数
if(WenCamTexture.devices.Length>0)
{
//获取设备的名字
string devicesName = WebCamTexture.devices[0].name;
//创建相机贴图
WebCamTexture webCamTexture =new WebCamTeture(devicesName,Screen.width,Screen.height);
//显示相机画面
camShow.texture = webCamTexture;
//启用相机
webCamTexture.Play();
}
else
{
Debug.Log(“设备没有相机”);
}
}
}