Operating System functions. Operating System functions. OS wraps the most common functionality to communicate with the host operating system, such as the clipboard, video driver, date and time, timers, environment variables, execution of binaries, command line, etc. Displays a modal dialog box using the host OS' facilities. Execution is blocked until the dialog is closed. Returns [code]true[/code] if the host OS allows drawing. Returns [code]true[/code] if the current host platform is using multiple threads. Centers the window on the screen if in windowed mode. Delay execution of the current thread by [code]msec[/code] milliseconds. Delay execution of the current thread by [code]usec[/code] microseconds. Dumps the memory allocation ringlist to a file (only works in debug). Entry format per line: "Address - Size - Description". Dumps all used resources to file (only works in debug). Entry format per line: "Resource Type : Resource Location". At the end of the file is a statistic of all used Resource Types. Execute the file at the given path with the arguments passed as an array of strings. Platform path resolution will take place. The resolved file must exist and be executable. The arguments are used in the given order and separated by a space, so [code]OS.execute("ping", ["-w", "3", "godotengine.org"], false)[/code] will resolve to [code]ping -w 3 godotengine.org[/code] in the system's shell. This method has slightly different behavior based on whether the [code]blocking[/code] mode is enabled. If [code]blocking[/code] is [code]true[/code], the Godot thread will pause its execution while waiting for the process to terminate. The shell output of the process will be written to the [code]output[/code] array as a single string. When the process terminates, the Godot thread will resume execution. If [code]blocking[/code] is [code]false[/code], the Godot thread will continue while the new process runs. It is not possible to retrieve the shell output in non-blocking mode, so [code]output[/code] will be empty. The return value also depends on the blocking mode. When blocking, the method will return -2 (no process ID information is available in blocking mode). When non-blocking, the method returns a process ID, which you can use to monitor the process (and potentially terminate it with [method kill]). If the process forking (non-blocking) or opening (blocking) fails, the method will return [code]-1[/code]. Example of blocking mode and retrieving the shell output: [codeblock] var output = [] OS.execute("ls", ["-l", "/tmp"], true, output) [/codeblock] Example of non-blocking mode, running another instance of the project and storing its process ID: [codeblock] var pid = OS.execute(OS.get_executable_path(), [], false) [/codeblock] If you wish to access a shell built-in or perform a composite command, a platform-specific shell can be invoked. For example: [codeblock] OS.execute("CMD.exe", ["/C", "cd %TEMP% && dir"], true, output) [/codeblock] Returns the scancode of the given string (e.g. "Escape"). Returns the total number of available audio drivers. Returns the audio driver name for the given index. Returns the command line arguments passed to the engine. Returns the currently used video driver, using one of the values from [enum VideoDriver]. Returns current date as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]dst[/code] (Daylight Savings Time). Returns current datetime as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]dst[/code] (Daylight Savings Time), [code]hour[/code], [code]minute[/code], [code]second[/code]. Gets a dictionary of time values corresponding to the given UNIX epoch time (in seconds). The returned Dictionary's values will be the same as [method get_datetime], with the exception of Daylight Savings Time as it cannot be determined from the epoch. Returns the total amount of dynamic memory used (only works in debug). Returns an environment variable. Returns the path to the current engine executable. Returns the IME cursor position (the currently-edited portion of the string) relative to the characters in the composition string. [constant MainLoop.NOTIFICATION_OS_IME_UPDATE] is sent to the application to notify it of changes to the IME cursor position. Returns the IME intermediate composition string. [constant MainLoop.NOTIFICATION_OS_IME_UPDATE] is sent to the application to notify it of changes to the IME composition string. Returns the current latin keyboard variant as a String. Possible return values are: [code]"QWERTY"[/code], [code]"AZERTY"[/code], [code]"QZERTY"[/code], [code]"DVORAK"[/code], [code]"NEO"[/code], [code]"COLEMAK"[/code] or [code]"ERROR"[/code]. Returns the host OS locale. Returns the model name of the current device. Returns the name of the host OS. Possible values are: [code]"Android"[/code], [code]"Haiku"[/code], [code]"iOS"[/code], [code]"HTML5"[/code], [code]"OSX"[/code], [code]"Server"[/code], [code]"Windows"[/code], [code]"UWP"[/code], [code]"X11"[/code]. Returns the amount of battery left in the device as a percentage. Returns an estimate of the time left in seconds before the device runs out of battery. Returns the current state of the device regarding battery and power. See [enum PowerState] constants. Returns the project's process ID. Returns the number of threads available on the host machine. Returns the window size including decorations like window borders. Returns the given scancode as a string (e.g. Return values: [code]"Escape"[/code], [code]"Shift+Escape"[/code]). Returns the number of displays attached to the host machine. Returns the dots per inch density of the specified screen. On Android devices, the actual screen densities are grouped into six generalized densities: [codeblock] ldpi - 120 dpi mdpi - 160 dpi hdpi - 240 dpi xhdpi - 320 dpi xxhdpi - 480 dpi xxxhdpi - 640 dpi [/codeblock] Returns the position of the specified screen by index. If no screen index is provided, the current screen will be used. Returns the dimensions in pixels of the specified screen. Returns the amount of time in milliseconds it took for the boot logo to appear. Returns the maximum amount of static memory used (only works in debug). Returns the amount of static memory being used by the program in bytes. Returns the actual path to commonly used folders across different platforms. Available locations are specified in [enum SystemDir]. Returns the epoch time of the operating system in milliseconds. Returns the epoch time of the operating system in seconds. Returns the amount of time passed in milliseconds since the engine started. Returns the amount of time passed in microseconds since the engine started. Returns current time as a dictionary of keys: hour, minute, second. Returns the current time zone as a dictionary with the keys: bias and name. Returns a string that is unique to the device. [b]Note:[/b] Returns an empty string on HTML5 and UWP, as this method isn't implemented on those platforms yet. Returns the current UNIX epoch timestamp. Gets an epoch time value from a dictionary of time values. [code]datetime[/code] must be populated with the following keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]hour[/code], [code]minute[/code], [code]second[/code]. You can pass the output from [method get_datetime_from_unix_time] directly into this function. Daylight Savings Time ([code]dst[/code]), if present, is ignored. Returns the absolute directory path where user data is written ([code]user://[/code]). On Linux, this is [code]~/.local/share/godot/app_userdata/[project_name][/code], or [code]~/.local/share/[custom_name][/code] if [code]use_custom_user_dir[/code] is set. On macOS, this is [code]~/Library/Application Support/Godot/app_userdata/[project_name][/code], or [code]~/Library/Application Support/[custom_name][/code] if [code]use_custom_user_dir[/code] is set. On Windows, this is [code]%APPDATA%\Godot\app_userdata\[project_name][/code], or [code]%APPDATA%\[custom_name][/code] if [code]use_custom_user_dir[/code] is set. [code]%APPDATA%[/code] expands to [code]%USERPROFILE%\AppData\Roaming[/code]. If the project name is empty, [code]user://[/code] falls back to [code]res://[/code]. Returns the number of video drivers supported on the current platform. Returns the name of the video driver matching the given [code]driver[/code] index. This index is a value from [enum VideoDriver], and you can use [method get_current_video_driver] to get the current backend's index. Returns the on-screen keyboard's height in pixels. Returns 0 if there is no keyboard or if it is currently hidden. Returns unobscured area of the window where interactive controls should be rendered. Returns [code]true[/code] if an environment variable exists. Returns [code]true[/code] if the feature for the given feature tag is supported in the currently running instance, depending on platform, build etc. Can be used to check whether you're currently running a debug build, on a certain platform or arch, etc. Refer to the [url=https://docs.godotengine.org/en/latest/getting_started/workflow/export/feature_tags.html]Feature Tags[/url] documentation for more details. [b]Note:[/b] Tag names are case-sensitive. Returns [code]true[/code] if the device has a touchscreen or emulates one. Returns [code]true[/code] if the platform has a virtual keyboard, [code]false[/code] otherwise. Hides the virtual keyboard if it is shown, does nothing otherwise. Returns [code]true[/code] if the build is a debug build. Returns [code]true[/code] when running in the editor. Returns [code]false[/code] if the build is a release build. Returns [code]true[/code] if the [b]OK[/b] button should appear on the left and [b]Cancel[/b] on the right. Returns [code]true[/code] if the input scancode corresponds to a Unicode character. Returns [code]true[/code] if the engine was executed with [code]-v[/code] (verbose stdout). If [code]true[/code], the [code]user://[/code] file system is persistent, so that its state is the same after a player quits and starts the game again. Relevant to the HTML5 platform, where this persistence may be unavailable. Returns [code]true[/code] if the window should always be on top of other windows. Kill (terminate) the process identified by the given process ID ([code]pid[/code]), e.g. the one returned by [method execute] in non-blocking mode. [b]Note:[/b] This method can also be used to kill processes that were not spawned by the game. Moves the window to the front. Returns [code]true[/code] if native video is playing. Pauses native video playback. Plays native video from the specified path, at the given volume and with audio and subtitle tracks. [b]Note:[/b] This method is only implemented on Android and iOS, and the current Android implementation does not support the [code]volume[/code], [code]audio_track[/code] and [code]subtitle_track[/code] options. Stops native video playback. Resumes native video playback. Shows all resources in the game. Optionally, the list can be written to a file by specifying a file path in [code]tofile[/code]. Shows the list of loaded textures sorted by size in memory. Shows the number of resources loaded by the game of the given types. Shows all resources currently used by the game. Request the user attention to the window. It'll flash the taskbar button on Windows or bounce the dock icon on OSX. At the moment this function is only used by [code]AudioDriverOpenSL[/code] to request permission for [code]RECORD_AUDIO[/code] on Android. Sets the game's icon using an [Image] resource. The same image is used for window caption, taskbar/dock and window selection dialog. Image is scaled as needed. Sets whether IME input mode should be enabled. If active IME handles key events before the application and creates an composition string and suggestion list. Application can retrieve the composition status by using [method get_ime_selection] and [method get_ime_text] functions. Completed composition string is committed when input is finished. Sets position of IME suggestion list popup (in window coordinates). Sets the game's icon using a multi-size platform-specific icon file ([code]*.ico[/code] on Windows and [code]*.icns[/code] on macOS). Appropriate size sub-icons are used for window caption, taskbar/dock and window selection dialog. [b]Note:[/b] This method is only implemented on macOS and Windows. Sets the name of the current thread. Enables backup saves if [code]enabled[/code] is [code]true[/code]. Sets whether the window should always be on top. Sets the window title to the specified string. Requests the OS to open a resource with the most appropriate program. For example. [code]OS.shell_open("C:\\Users\name\Downloads")[/code] on Windows opens the file explorer at the downloads folders of the user. [code]OS.shell_open("https://godotengine.org")[/code] opens the default web browser on the official Godot website. Shows the virtual keyboard if the platform has one. The [code]existing_text[/code] parameter is useful for implementing your own LineEdit, as it tells the virtual keyboard what text has already been typed (the virtual keyboard uses it for auto-correct and predictions). The clipboard from the host OS. Might be unavailable on some platforms. The current screen index (starting from 0). The exit code passed to the OS when the main loop exits. If [code]true[/code], the engine tries to keep the screen on while the game is running. Useful on mobile. If [code]true[/code], the engine optimizes for low processor usage by only refreshing the screen if needed. Can improve battery consumption on mobile. The maximum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value. The minimum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value. The current screen orientation. If [code]true[/code], vertical synchronization (Vsync) is enabled. If [code]true[/code], removes the window frame. [b]Note:[/b] Setting [code]window_borderless[/code] to [code]false[/code] disables per-pixel transparency. If [code]true[/code], the window is fullscreen. If [code]true[/code], the window is maximized. If [code]true[/code], the window is minimized. If [code]true[/code], the window background is transparent and window frame is removed. Use [code]get_tree().get_root().set_transparent_background(true)[/code] to disable main viewport background rendering. [b]Note:[/b] This property has no effect if [b]Project > Project Settings > Display > Window > Per-pixel transparency > Allowed[/b] setting is disabled. The window position relative to the screen, the origin is the top left corner, +Y axis goes to the bottom and +X axis goes to the right. If [code]true[/code], the window is resizable by the user. The size of the window (without counting window manager decorations). The GLES2 rendering backend. It uses OpenGL ES 2.0 on mobile devices, OpenGL 2.1 on desktop platforms and WebGL 1.0 on the web. The GLES3 rendering backend. It uses OpenGL ES 3.0 on mobile devices, OpenGL 3.3 on desktop platforms and WebGL 2.0 on the web. Sunday. Monday. Tuesday. Wednesday. Thursday. Friday. Saturday. January. February. March. April. May. June. July. August. September. October. November. December. Landscape screen orientation. Portrait screen orientation. Reverse landscape screen orientation. Reverse portrait screen orientation. Uses landscape or reverse landscape based on the hardware sensor. Uses portrait or reverse portrait based on the hardware sensor. Uses most suitable orientation based on the hardware sensor. Desktop directory path. DCIM (Digital Camera Images) directory path. Documents directory path. Downloads directory path. Movies directory path. Music directory path. Pictures directory path. Ringtones directory path. Unknown powerstate. Unplugged, running on battery. Plugged in, no battery available. Plugged in, battery charging. Plugged in, battery fully charged.