0
我有以下脚本来打开一个GUI.Window作为一个切换按钮弹出。在Unity3d编辑器中,脚本运行o.k.,窗口在开关按钮点击时打开关闭。 当我将场景编译到我的Android设备时,脚本会运行,但我只能用触摸切换按钮打开GUI.Window,并且在再次触摸按钮时无法关闭它。GUI。Unity中的切换按钮不关闭弹出窗口
看看脚本,并给我一些建议,为什么发生这种情况,这个UnityScript有什么问题?谢谢大家提前。
下面是脚本:
#pragma strict
private var doWindow0 : boolean = false;
var aTexture : Texture;
var wTexture : Texture;
// Make the contents of the window.
function DoWindow0 (windowID : int) {
GUI.color = Color.cyan;
GUI.Box (new Rect (10,10,415,210),wTexture);
}
function OnGUI() {
if(!aTexture) {
Debug.LogError("Please assign a texture in the inspector.");
return;
}
// Make a toggle button for hiding and showing the window
doWindow0 = GUI.Toggle(Rect(210,210,70,20), doWindow0, aTexture);
//doWindow0 = GUI.Button (new Rect (10,10,100,20), doWindow0, "InfoBox");
// Make sure we only call GUI.Window if doWindow0 is true.
if (doWindow0)
GUI.Window (0, Rect (30,0,420,215), DoWindow0, "InfoBox");
// Make the windows be draggable.
GUI.DragWindow (Rect (0,0,10000,10000));
}