Hi I have a question:
I need my project turn in ipad (correct screen orientation)
when the device turn too.
In other words:
When the user turns the device, the display also must have the correct position required by apple.
how can I do that in unity please ?
thanks.
This will do the trick, though if you don’t use OpenFeint you’ll need to comment out that line.
public void Update ()
{
if (!setOF)
{
OpenFeint.SetDashboardOrientation(Input.deviceOrientation);
setOF = true;
}
if( Input.deviceOrientation != lastOrientation )
{
OpenFeint.SetDashboardOrientation(Input.deviceOrientation);
if( Input.deviceOrientation == DeviceOrientation.LandscapeLeft)
{
iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeLeft;
lastOrientation = Input.deviceOrientation;
}
else if( Input.deviceOrientation == DeviceOrientation.LandscapeRight)
{
iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeRight;
lastOrientation = Input.deviceOrientation;
}
}
}