Input.deviceOrientation 设备方向

static var deviceOrientation : DeviceOrientation

Description描述

Device physical orientation as reported by OS (Read Only).

操作系统所报告的物理设备的方位信息(只读)

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void Update() {

		if (Input.deviceOrientation == DeviceOrientation.FaceDown)

			audio.Play();



	}

}
// Play a sound if screen is facing downwards

//如果屏幕朝下,播放声音



function Update () {

	if (Input.deviceOrientation == DeviceOrientation.FaceDown)

		audio.Play();

}
Page last updated: 2011-3-30