【发布时间】:2015-01-07 19:01:09
【问题描述】:
我正在制作我的第一个统一的 2d 游戏,并且我正在尝试做一个主菜单。
void OnGUI(){
GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), MyTexture);
if (Screen.orientation == ScreenOrientation.Landscape) {
GUI.Button(new Rect(Screen.width * .25f, Screen.height * .5f, Screen.width * .5f, 50f), "Start Game");
} else {
GUI.Button(new Rect(0, Screen.height * .4f, Screen.width, Screen.height * .1f), "Register");
}
}
如果设备的方向是横向,我想写出开始游戏按钮,如果是纵向,我想写出寄存器。现在即使我在横向模式下玩游戏,它也会写出注册按钮。怎么了?
【问题讨论】: