Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
OS¶
Inherits: Object
Provides access to common operating system functionalities.
Description¶
This class wraps the most common functionalities for communicating with the host operating system, such as the video driver, delays, environment variables, execution of binaries, command line, etc.
Note: In Godot 4, OS functions related to window management were moved to the DisplayServer singleton.
Tutorials¶
Properties¶
|
||
|
||
|
Methods¶
Enumerations¶
enum RenderingDriver:
RenderingDriver RENDERING_DRIVER_VULKAN = 0
The Vulkan rendering driver. It requires Vulkan 1.0 support and automatically uses features from Vulkan 1.1 and 1.2 if available.
RenderingDriver RENDERING_DRIVER_OPENGL3 = 1
The OpenGL 3 rendering driver. It uses OpenGL 3.3 Core Profile on desktop platforms, OpenGL ES 3.0 on mobile devices, and WebGL 2.0 on Web.
enum SystemDir:
SystemDir SYSTEM_DIR_DESKTOP = 0
Desktop directory path.
SystemDir SYSTEM_DIR_DCIM = 1
DCIM (Digital Camera Images) directory path.
SystemDir SYSTEM_DIR_DOCUMENTS = 2
Documents directory path.
SystemDir SYSTEM_DIR_DOWNLOADS = 3
Downloads directory path.
SystemDir SYSTEM_DIR_MOVIES = 4
Movies directory path.
SystemDir SYSTEM_DIR_MUSIC = 5
Music directory path.
SystemDir SYSTEM_DIR_PICTURES = 6
Pictures directory path.
SystemDir SYSTEM_DIR_RINGTONES = 7
Ringtones directory path.
Property Descriptions¶
bool delta_smoothing = true
If true
, the engine filters the time delta measured between each frame, and attempts to compensate for random variation. This will only operate on systems where V-Sync is active.
bool low_processor_usage_mode = false
If true
, the engine optimizes for low processor usage by only refreshing the screen if needed. Can improve battery consumption on mobile.
int low_processor_usage_mode_sleep_usec = 6900
void set_low_processor_usage_mode_sleep_usec ( int value )
int get_low_processor_usage_mode_sleep_usec ( )
The amount of sleeping between frames when the low-processor usage mode is enabled (in microseconds). Higher values will result in lower CPU usage.
Method Descriptions¶
void alert ( String text, String title="Alert!" )
Displays a modal dialog box using the host OS' facilities. Execution is blocked until the dialog is closed.
void close_midi_inputs ( )
Shuts down system MIDI driver.
Note: This method is implemented on Linux, macOS and Windows.
void crash ( String message )
Crashes the engine (or the editor if called within a @tool
script). This should only be used for testing the system's crash handler, not for any other purpose. For general error reporting, use (in order of preference) @GDScript.assert,