unity-game-engine - Unity 上的等待功能

标签 unity-game-engine unityscript

我想等到按下“下一步”按钮然后继续

child.addChild(tmp);
childrenAdded.Push(tmp);
neighbor.GetComponent.<Renderer>().material.mainTexture = null;                     
-WAIT UNTIL CLICK ON NEXT BUTTON THEN CONTINUE-

toExpand.Push(tmp);

有什么想法吗?我尝试过:

while(true) {
    if(GUI.Button(Rect(500,680 ,100,30),"Next"))
        break
    }

但是这不起作用;它卡住了。

最佳答案

您可以在单击按钮时调用代码,而不是等待,如下所示:

void OnGUI() {
    if(GUI.Button(Rect(500,680 ,100,30),"Next"))                        
        toExpand.Push(tmp);
    }
}

如果可能,请考虑使用 Unity 4.6 或更高版本,以便您可以使用 new UI这更容易使用。

关于unity-game-engine - Unity 上的等待功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32039800/

相关文章:

android - 我应该为 iOS(Game Center) 和 Android(Google Play Games) 创建不同的项目吗?

unity-game-engine - unity hub 不允许我安装 unity;错误: "There is not enough space to download and install the selected items"

c# - 未找到 key 异常-Unity Json

unity3d - 如何统一等待特定秒数

unity-game-engine - 如何确定 Unity 插件是否挂起(来自 unityscript)

c# - Unity定期设置PlayerPrefs数据

python - 正确设置 Unity SerializedProperty 值

unity-game-engine - 如何使对象在统一首次启动时仅可见一次

javascript - 如何让我的文本在 Unity 中显示我的分数?

c# - 如何加载您在当前场景中创建的新场景?