[SOLVED]Orientation weird behavior

Hi everyone,

We are trying to find out how to fix following problem:

  1. The game has following code for the screen orientation:
    function Awake()
    {
    iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeLeft;
    DontDestroyOnLoad(this);
    }

  2. When I move the iPhone or iPod Touch from the landscape to portrait It does seem to shake a little and we can see some frame trying to rotate and it’s coming back - not the whole screen, but something like a black frame behind the screen and we notice the black corners of it for half of the second

  3. It does the same during whole program - doesn’t matter if it’s menu or the game itself. Always happens when tries to rotate the device.

Anyone experienced that or know how to fix it? We doesn’t want to rotate the screen at all.

Please advice.

Thanks in advance.
Szymon

Forgot to mention that we are on iPhone Advanced license.

I only see problems with it when using the Remote (it doesn’t move.) Is the problem happening on the deployed version?

Yes, on the deployed. Have no idea how to fix it. Anyone?

Please, anyone? We’ve got final build and that’s the only thing which stops me from publishing the game.

Hello!

Do you have a small project we can check?

Here is the zip file with the Assets.

Also, here is the code:

  1. Here comes the AManagerClass from Wiki
    #################
    // gameController
static var instance : gameController;
instance =  FindObjectOfType(gameController);

if (instance == null)
{
	Debug.Log("Could not locate an gameController object.");
}

function OnApplicationQuit()
{
	instance = null;
}

function Awake()
{
	DontDestroyOnLoad(this);
}

################

  1. Our splash screen

##############
//screenSplash

private var texSplash : Texture;

function Awake()
{
	texSplash = Resources.Load("Textures/Menu/Splash");
}

function OnGUI()
{
	GUI.DrawTexture(Rect(0, 0, 480, 320), texSplash);
}

################

Any ideas? We’ve noticed that it started happening after 1.5 Unity iPhone update.

202359–7475–$assets_161.zip (263 KB)

Anyone? We want to publish the game today and that’s the only thing stopping us.

What OS and what sdk are you building against?

The only time I can get the black corners to show is to change the volume so the volume icon shows and immediately rotate the device - I see the corners but it is only as it rotates the volume icon overlay itself.

I’m using 1.5 on a 3gs running 3.0, built against 2.1 using the 3.0 SDK.

cheers,
grant

Unity iPhone Advanced 1.5 on 3 different devices: iPhone 3G, iPod Touch 8GB and 16GB. All behaves same way. OS 3.1, SDK 3.1.

I’ve set the default screen orientation to Landscape Left using Player settings in the Editor and added following code to your screenSplash script.

function Start() {
	iPhoneKeyboard.autorotateToPortrait = false;
	iPhoneKeyboard.autorotateToPortraitUpsideDown = false;
	iPhoneKeyboard.autorotateToLandscapeRight = false;
	iPhoneKeyboard.autorotateToLandscapeLeft = false;
	}

The problem is gone now.

WOW !!! YOU’VE MADE MY DAY !!!

THANK YOU SO MUCH !!!! It works like a charm. Thank you !!!

Was happy to help. We’ll document this case in the docs with the next Unity iPhone release.

This caused my flickering issue to go away as well. But more importantly it seems to have fixed a major performance issue that was driving me crazy.

My frametimes were spiking 15 ms when the device was tilted, causing a hitch in my game. It started with the 1.5 update, and no matter what I did it wouldn’t go away. After putting this code in the game, the frametime spikes are no more, and my game plays much more smoothly.

Thanks! :smile:

This problem has been driving me mad since I noticed it in my game a couple of weeks back

I only just saw this thread, and its fixed my issues as well - so thank you!