sleepTimeout
A power-saving setting that lets the screen dim after a period of user inactivity.
읽는 시간 2분최근 업데이트: 13시간 전
Definition
- Type: Property
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public static int sleepTimeout { get; set; }
Remarks
This setting is most useful for handheld devices, as it lets the operating system preserve battery life.
On mobile devices that use the accelerometer as the main source of input, consider setting to SleepTimeout.NeverSleep during gameplay, and restoring SleepTimeout.SystemSetting in menus or while the game is paused.
sleepTimeoutThe valid values are SleepTimeout.NeverSleep and SleepTimeout.SystemSetting. Unity doesn't support setting a fixed number of seconds. Unity treats any other value as SleepTimeout.SystemSetting. The default value and the value the getter returns vary by platform:
- On Android, the default value is SleepTimeout.SystemSetting, and the getter returns the actual system screen-off timeout value, in seconds.
- On iOS and tvOS, the default value is SleepTimeout.SystemSetting. The getter returns only SleepTimeout.SystemSetting or SleepTimeout.NeverSleep, never a specific number of seconds. When you launch an iOS app from Xcode, the device doesn't auto-lock, even if is set to SleepTimeout.SystemSetting. The device locks as normal when you launch the app from the home screen.
sleepTimeout - On the macOS Standalone Player, the default value is SleepTimeout.NeverSleep, which prevents the display and the system from sleeping while the application runs. If you set to SleepTimeout.SystemSetting, the display and the system sleep according to the user's sleep settings in macOS. The getter only returns SleepTimeout.NeverSleep or SleepTimeout.SystemSetting.
sleepTimeout - On the Windows Standalone Player, the default value is SleepTimeout.NeverSleep. The getter only returns SleepTimeout.NeverSleep or SleepTimeout.SystemSetting.
- On Universal Windows Platform (UWP), the default value is SleepTimeout.SystemSetting. The getter only returns SleepTimeout.NeverSleep or SleepTimeout.SystemSetting.
- On the Web platform, always returns SleepTimeout.NeverSleep, and setting it has no effect.
sleepTimeout
using UnityEngine;public class Example : MonoBehaviour{ void Start() { // Disable screen dimming Screen.sleepTimeout = SleepTimeout.NeverSleep; }}
Additional Resources: SleepTimeout.