【问题标题】:How i can run unity app in background on Android?我如何在 Android 后台运行 unity 应用程序?
【发布时间】:2022-11-23 13:24:48
【问题描述】:

我有一个问题,我需要我的 Android 应用程序在后台保持活动状态。

Application.runInBackground = true;

【问题讨论】:

    标签: c# android unity3d background


    【解决方案1】:

    来自this unity question

    Project Settings, Player, Resolution and Presentation,勾选Run in Background选项。

    【讨论】:

    • Android 应用程序没有这样的部分
    • @Dimon 没有这样的部分是什么意思?我不知道 unity 隐藏选项,因为它无法事先知道它正在构建到哪个平台。
    • 我的意思是,此功能仅适用于 pc
    • @Dimon 它会抛出错误吗?
    • 不,没有“在后台运行选项”
    【解决方案2】:

    Unity 创建的 Android 应用程序无法在后台运行。 Application.runInBackground 在 Android 和 iOS 平台上被忽略。对于 Android,Unity 应用程序扩展 Activity 类,该类仅在应用程序处于焦点时运行。如果你想在后台运行一些东西,你应该在 Service 类中扩展和编写逻辑。 here 描述的很好。但它需要编写你自己的插件或类似的东西。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-25
      相关资源
      最近更新 更多