Detecting device orientation change on iOS

How to detect when a device (iPhone or iPad) changes orientation?

http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.html shows various overridable functions such as OnMouseEnter. It’d be great if there is something like OnDeviceChange().

Thanks in advance for your help.

2 Answers

2

There’s Input.deviceOrientation

No. pion wanted the callback.

@shinriyo_twitter : you can generate whatever event you want from that answer. Just have to monitor the value Input.deviceOrientation and check for modification.

Consider this forum post …

DeviceChange.OnOrientationChange

Scroll down to Doug.McFarlane

DeviceChange.OnOrientationChange += MyOrientationChangeCode;
void MyOrientationChangeCode(DeviceOrientation orientation) {}