- Home /
Unity in UITabController app
I've integrated Unity into a UITabBarController app that I'm working on. It's almost 100% working with a bunch of changes to the app controller. The one thing I can't figure out is auto-rotation. It seems that Unity is doing a lot of transposing of rotations from Unity to iOS and vice versa and there's a lot of stuff happening to make orientation changes and auto-rotation accessible from the unity side. The only way I've been able to get auto-rotation to work inside a UITabBarController is to overwrite the app controller's shouldAutorotateToInterfaceOrientation with:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
This is a bit of a sledgehammer, getting rid of a whole bunch of Unity logic for handling rotations which, try as I might, I couldn't make return YES when it was supposed to (i.e. the tab bar controller would never rotate). This works, resizing/scaling the EAGL view upon rotation to take into account the tab bar and everything...The problem is this : If I start in landscape mode, the Unity view and the tab bar are rotated correctly but the Unity view is not scaled correctly. The scaling happens when the EAGL surface is destroyed and recreated. For some reason, this is not happening when the app starts.
Has anyone attempted to do this and achieved proper rotations with a minimum of mucking around with the Unity logic?
Thanks in advance.
Answer by johnnyclem · Feb 08, 2012 at 05:25 AM
Would you mind sharing how you got the uitabcontroller to work with unity? i'm trying to do the exact same thing (except i don't really need autorotation)
Your answer
![](https://koobas.hobune.stream/wayback/20220612190122im_/https://answers.unity.com/themes/thub/images/avi.jpg)