How do I rotate my app?

I have done a number of searches on orientation and rotation etc, all I find are a multitude of posts on how do I stop the black frame on rotation, nothing on how I rotate my app when someone flips the phone/ipad.

So how do I rotate my app?

		protected void AdjustOrientation() {
			m_currentOrientation = Input.deviceOrientation;
			switch (m_currentOrientation) {
				case DeviceOrientation.LandscapeLeft:
					if (Screen.orientation != ScreenOrientation.LandscapeLeft) {
						Screen.orientation = ScreenOrientation.LandscapeLeft;
					}
					break;
				case DeviceOrientation.LandscapeRight:
					if (Screen.orientation != ScreenOrientation.LandscapeRight) {
						Screen.orientation = ScreenOrientation.LandscapeRight;
					}
					break;
			}
		}

Call this on Start() and Awake(). You’ll need to add cases for the portrait orientations if you’d like to support them.

Er, and you’ll need DeviceOrientation m_currentOrientation in your script as well.

Thanks!

Thanks for share~

Notice that this method will just imediatly change your apps orientation.
this is no smooth animated rotation as you are just to from other apps.

The next problem to look out for is: What happens when device lays flat on the ground? For this you need to put even more if thens in catching this condition.

And you will still get the black rotating frame on top, when keyboard is not disabled in appcontroller.mm.

The hardcore way to get iPhone like rotations is to put the EAGLview somehow into a viewcontrollers view. But then you have new problems with touch coordinates. And this rquieres a great deal of understanding xcode and objective c.

You would think there would be an example in the Penelope or one of the other examples?