- Home /
Unity iPhone - Changing to Landscape in code
Hi all,
I am making an app where the menu systems are all to be viewed in Portrait mode. On a particular screen it needs to operate in landscape...
I've looked at setting: iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeRight;
This however, doesn't change the unity player to landscape when I hit play and browse to my horizontal screen.
Also, I need to be able to position things in X and Y normally... at the moment, i'm trying to create my gameObjects and sprites in a rotated manner, so that it gives the appearence of needing to be viewed on the side.. as you can imagine this is very fiddly and ovbiously the long way around this problem.
Any help VERY gratefully receieved.
thanks
Mat
Were you ever able to fix this? I know it's 2016, and this query is about 6 years old now. But I am in just the same Situation.
Answer by Eric5h5 · May 05, 2010 at 11:26 PM
iPhoneSettings.screenOrientation
doesn't change the orientation in the Unity editor; it only has a visible effect on the device.
Answer by MSylvia · Sep 14, 2010 at 05:58 PM
In your game view tab exactly under the tab is a dropdown list of orientations you can choose from to change the view in the editor. It has no effect on the build however you would have to set iPhoneSettings.screenOrientation
as Eric5h5 said.
Answer by omidud · Jul 05, 2015 at 09:26 PM
if (Application.isMobilePlatform == true) //work with Iphone android, (mobile device)
{
Screen.orientation = ScreenOrientation.Landscape; //or Portrait
}
Hi Omidud! I am using this but strangely it does work well on Android but totally not working in iOS.