IInterfaceOrientationPortrait and UIInterfaceOrientationPort

My unity iphone app runs horizontally when starts up. And it cannot rotate vertically to view.

Where should I set the orientation be both horizontally and vertically?

You can detect the current orientation using the iPhoneInput.orientation property.

I tried the following code:

using UnityEngine;
using System.Collections;

public class SetScreen : MonoBehaviour
{
	void Awake ()
	{
		iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeLeft;
		if ((iPhoneInput.orientation == iPhoneOrientation.LandscapeLeft)  (iPhoneSettings.screenOrientation != iPhoneScreenOrientation.LandscapeLeft)) 
        { 
        	iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeLeft; 
        } 
    
        if ((iPhoneInput.orientation == iPhoneOrientation.LandscapeRight)  (iPhoneSettings.screenOrientation != iPhoneScreenOrientation.LandscapeRight)) 
        { 
        	iPhoneSettings.screenOrientation = iPhoneScreenOrientation.Portrait; 
        }    
	}
}

screen orientation did not change.

How should I change the code to enable both landscape and portrait views?

anyone could help?

anyone could help?

you might want to try doing your test in the Update method, Awake only gets called once… i think ^^

function OnGUI () {
	GUI.Label(Rect(10,10,200,30),"orientation: " + iPhoneInput.orientation);
}

I put this chunk of Javascript on my camera and i was abel to see the orientation changing as i moved the device.

I hope this helps