【发布时间】:2014-05-06 22:22:11
【问题描述】:
我有以下脚本来打开一个 GUI.Window 作为带有切换按钮的弹出窗口。在 Unity3d 编辑器播放器中,脚本运行正常,单击切换按钮时窗口打开关闭。 当我将场景编译到我的 Android 设备时,脚本会运行,但我只能使用触摸切换按钮打开 GUI.Window,并且再次触摸按钮时无法关闭它。
看看脚本,给我一些建议为什么会这样,这个 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));
}
【问题讨论】:
标签: android user-interface unity3d popupwindow unityscript