Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Input.deviceOrientation

Switch to Manual
public static var deviceOrientation: DeviceOrientation;

Description

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

#pragma strict
var audio: AudioSource;
function Start() {
	audio = GetComponent.<AudioSource>();
}
function Update() {
	if (Input.deviceOrientation == DeviceOrientation.FaceDown)
		audio.Play();
}