我有一些代码如下:
if( GUI.Button(
new Rect(Screen.width/4f,50f,Screen.width/2f,Screen.height/9f),"RessetLevel")) {
showingWinsows = true;
if(showingWinsows)
{
rectWindow = GUI.Window(
0,
rectWindow,
DoMyWindow,
"Are you sure you want to reset All level ?"
);
}
我已在userGuiLayout = false;
功能中插入Awake()
。但窗口仍然没有显示。我该如何解决这个问题?
答案 0 :(得分:0)
问题是只在按下按钮时才会绘制窗口。
你需要将检查标志的代码移出if(GUI.Button),如下所示:
if( GUI.Button(new Rect(Screen.width/4f,50f,Screen.width/2f,Screen.height/9f),"Resset Level"))
{
showingWinsows = true;
}
if(showingWinsows)
{
rectWindow = GUI.Window(0,rectWindow,DoMyWindow,"Are you sure you want to reset All level ?");
}