Version: 2023.2

Application.runInBackground

切换到手册
public static bool runInBackground ;

描述

Should the Player be running when the application is in the background?

默认值为 false(应用程序在后台时将暂停)。

Android: Works only in cases if the application is unfocused, but visible. For example, when run in multi-window mode - Samsung Dex, Oculus Quest 2, ChromeOS, etc. If the application is truly in background, the application pauses regardless of Application.runInBackground option. If you want to execute tasks while in background, you need to implement background service.

Note: This property is ignored on iOS.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Example() { Application.runInBackground = true; } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961