Input.deviceOrientation

Switch to Manual
public static DeviceOrientation deviceOrientation ;

Description

操作系统报告的设备的物理方向。(只读)


using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { AudioSource audioSource;

void Start() { audioSource = GetComponent<AudioSource>(); }

void Update() { if (Input.deviceOrientation == DeviceOrientation.FaceDown) audioSource.Play(); } }