ISSUE-013
Unity游戏屏幕方向错误
常见表现
屏幕方向错误。
相关源码
Unity引擎 UnityAppController+ViewHandling.mm
- (UIViewController*)createRootViewController
{
UIViewController* ret = nil;
if (!UNITY_SUPPORT_ROTATION || UnityShouldAutorotate())
ret = [self createUnityViewControllerDefault];
if (ret == nil)
ret = [self createRootViewControllerForOrientation: ConvertToIosScreenOrientation((ScreenOrientation)UnityRequestedScreenOrientation())];
return ret;
}
原因分析
原因不明。
解决方法
方法一:尝试通过command+R旋转屏幕方向。
方法二:写入补丁,屏蔽源码中对createUnityViewControllerDefault的调用,createRootViewControllerForOrientation的传入参数修改为UIInterfaceOrientationLandscapeLeft (4)。