【问题标题】:Stop Ursina engine from calling update function停止 Ursina 引擎调用更新函数
【发布时间】:2022-01-02 00:19:00
【问题描述】:

如何让 Ursina 引擎在特定条件后每帧停止调用 update() 函数,同时运行脚本的其余部分

application.quit() 终止我的脚本,app.destroy() 只是关闭窗口,同时仍然在每一帧调用update()

【问题讨论】:

    标签: python ursina


    【解决方案1】:

    您可以在update() 函数中以guard 的形式处理这种情况:

    def update():
        if condition:
            return
        # normal code...
    

    【讨论】:

      猜你喜欢
      • 2022-01-02
      • 2022-07-12
      • 1970-01-01
      • 2023-02-14
      • 2022-11-18
      • 1970-01-01
      • 1970-01-01
      • 2018-01-24
      • 2021-09-13
      相关资源
      最近更新 更多