기술 자료

Unity Engine

Unity Engine

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
sleepTimeout
to SleepTimeout.NeverSleep during gameplay, and restoring SleepTimeout.SystemSetting in menus or while the game is paused.
The 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:
using UnityEngine;public class Example : MonoBehaviour{ void Start() { // Disable screen dimming Screen.sleepTimeout = SleepTimeout.NeverSleep; }}
Additional Resources: SleepTimeout.