Version: 2021.2

Input.deviceOrientation

切换到手册
public static DeviceOrientation deviceOrientation ;

描述

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

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(); } }