Somewhat easy fix for rotating black screen (iPhoneKeyboard rotation)

So like others, this rotating black square has bugged me.

Tried to add a view controller and it just caused problems, eventually figured out this solution.

Not sure how much it will effect performance (if at all) but try it out and see if it works well enough for you.

All changes made to AppController.mm

after the EAGLView is added to the UIWindow add the following line

[UIView setAnimationsEnabled:NO];

At the bottom of the Repaint function in AppController.mm add the following code

if ([UIView areAnimationsEnabled])
{
[UIView setAnimationsEnabled:NO];
}

Again, not sure if the conditional is necessary, but there may be some behind the scenes stuff going on in setAnimationsEnabled, so it may be a good idea to keep it.

Also, keep in mind that while I’m pretty sure this code shouldn’t cause any problems just test it out a bit.

That effect is also the keyboard mask, and it can be turned off inside unity :slight_smile:

yes true, but then the keyboard doesn’t rotate as it should (if you need it)

I’m gonna give that a try, I hate the black border!!!
And I need my keyboard to be able to rotate.
Thanks Brad, I’ll see how it goes.

I have been desperately seeking to do as your hint suggests and be rid of those horrid black borders once and for all however was unable to get this code to work… I need to allow rotation of the screen for an iPad build and as such need to allow the keyboard to rotate with the device however even after implementing this code as instructed, the dreaded black border when rotating remains…

Were you saying this should work or that you have actually tested it and it works? I put it in the OpenEAGL_UnityCallback where the EAGLview is added as well as the conditional at the end of Repaint however when I rotate I still see those dreaded black edges…

Any help would be greatly appreciated.

It works fine for me on the iPhone, I’ll test the iPad out tonight but I don’t see why that wouldn’t work.

Just Checked and it works fine with the iPad!

Search for the blue text and replace whatever is there with the orange.

[_window addSubview:view];
[UIView setAnimationsEnabled:NO];

#endif
if ([UIView areAnimationsEnabled])
{
[UIView setAnimationsEnabled:NO];
}
}

Thanks again - brad.condran. You rOck!!!

As I don’t need any keyboard rotation, I might go with this.

Confirm that the black borders are gone / worked on iPad. I had put the code before the ‘#endif’ in the Repaint function instead of after it causing it to be in-effectual… Many thanks to brad.cordan, petey and JRavey for helping with the solution.

Now if only I could figure out how to get the keyboard based popup components to pay attention the the Screen.orientation

http://forum.unity3d.com/threads/92102-iPad-Rotation-woes…-again…

LOL, I didn’t do anything!

hehe… thanks anyhow…

Alas tho, after getting this working, as with all things ‘magical’ there appears to be some negative side effects. Since doing this we have had trouble with the gamecenter ‘slide down’ notification message to remind the player that gamecenter has connected… Sometimes you see it flash for a frame like a glitch other times you dont see it at all. I have also read about other devs having trouble with text entry fields without animations enabled (something to do with the little magnifying glass not working properly)…

Have any of you got GameCenter in their app and is it showing the ‘welcome’ animated slide down prompt ok?