我想在Unity安卓版本里面实现一种效果,就是软件打开是竖屏,通过点击相应的按钮打开另外一个场景,这个场景实现横屏的效果,该怎么做呢,build那里的Resolution设置为Auto Rotation后整个软件都能自动旋转了,主界面是竖屏的也能旋转,这样子看上去很怪
void Awake()
{
//设置屏幕正方向在Home键右边
Screen.orientation = ScreenOrientation.LandscapeRight;
}
void Start ()
{
//设置屏幕自动旋转, 并置支持的方向
Screen.orientation = ScreenOrientation.AutoRotation;
Screen.autorotateToLandscapeLeft = true;
Screen.autorotateToLandscapeRight = true;
Screen.autorotateToPortrait = false;
Screen.autorotateToPortraitUpsideDown = false;
}
合适的时候用代码设置,参考下