OS
Provides access to common operating system functionalities.
Provides access to common operating system functionalities.
The OS 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 Reckfell, OS functions related to window management, clipboard, and TTS were moved to the DisplayServer singleton (and the Window class). Functions related to time were removed and are only available in the Time class.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Properties4
DeltaSmoothingProperty
public static bool DeltaSmoothing { get; set; }If true, the engine filters the time delta measured between each frame, and attempts to compensate for random variation. This only works on systems where V-Sync is active.
Note: On start-up, this is the same as ProjectSettings.application/run/delta_smoothing.
LowProcessorUsageModeProperty
public static bool LowProcessorUsageMode { get; set; }If true, the engine optimizes for low processor usage by only refreshing the screen if needed. Can improve battery consumption on mobile.
Note: On start-up, this is the same as ProjectSettings.application/run/low_processor_mode.
LowProcessorUsageModeSleepUsecProperty
public static int LowProcessorUsageModeSleepUsec { get; set; }The amount of sleeping between frames when the low-processor usage mode is enabled, in microseconds. Higher values will result in lower CPU usage. See also OS.LowProcessorUsageMode.
Note: On start-up, this is the same as ProjectSettings.application/run/low_processor_mode_sleep_usec.
SingletonProperty
public static OSInstance Singleton { get; }Methods93
AddLoggervoid
public static void AddLogger(Logger logger);Add a custom logger to intercept the internal message stream.
| Name | Type | Default |
|---|---|---|
logger | Logger | — |
Alertvoid
public static void Alert(string text, string title = "Alert!");Displays a modal dialog box using the host platform's implementation. The engine execution is blocked until the dialog is closed.
| Name | Type | Default |
|---|---|---|
text | string | — |
title | string | "Alert!" |
CloseMidiInputsvoid
public static void CloseMidiInputs();Shuts down the system MIDI driver. Reckfell will no longer receive InputEventMidi. See also OS.OpenMidiInputs and OS.GetConnectedMidiInputs.
Note: This method is implemented on Linux, macOS, Windows, and Web.
Crashvoid
public static void Crash(string message);Crashes the engine (or the editor if called within a @tool script). See also OS.Kill.
Note: This method 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) @C#.assert, ReckfellApi.PushError, or OS.Alert.
| Name | Type | Default |
|---|---|---|
message | string | — |
CreateInstance2 overloads
public static int CreateInstance(ReadOnlySpan<string> arguments);Creates a new instance of Reckfell that runs independently. The arguments are used in the given order and separated by a space.
If the process is successfully created, this method returns the new process's ID, which you can use to monitor the process (and potentially terminate it with OS.Kill). If the process cannot be created, this method returns -1.
See OS.CreateProcess if you wish to run a different process.
Note: This method is implemented on Android, Linux, macOS, and Windows.
| Name | Type | Default |
|---|---|---|
arguments | ReadOnlySpan<string> | — |
intpublic static int CreateInstance(string[] arguments);Creates a new instance of Reckfell that runs independently. The arguments are used in the given order and separated by a space.
If the process is successfully created, this method returns the new process's ID, which you can use to monitor the process (and potentially terminate it with OS.Kill). If the process cannot be created, this method returns -1.
See OS.CreateProcess if you wish to run a different process.
Note: This method is implemented on Android, Linux, macOS, and Windows.
| Name | Type | Default |
|---|---|---|
arguments | string[] | — |
intCreateProcess2 overloads
public static int CreateProcess(string path, ReadOnlySpan<string> arguments, bool openConsole);Creates a new process that runs independently of Reckfell. It will not terminate when Reckfell terminates. The path specified in path must exist and be an executable file or macOS .app bundle. The path is resolved based on the current platform. The arguments are used in the given order and separated by a space.
On Windows, if open_console is true and the process is a console app, a new terminal window will be opened.
If the process is successfully created, this method returns its process ID, which you can use to monitor the process (and potentially terminate it with OS.Kill). Otherwise, this method returns -1.
Example: Run another instance of the project:
var pid = OS.CreateProcess(OS.GetExecutablePath(), []);See OS.Execute if you wish to run an external command and retrieve the results.
Note: This method is implemented on Android, Linux, macOS, and Windows.
Note: On macOS, sandboxed applications are limited to run only embedded helper executables, specified during export or system .app bundle, system .app bundles will ignore arguments.
| Name | Type | Default |
|---|---|---|
path | string | — |
arguments | ReadOnlySpan<string> | — |
openConsole | bool | — |
intpublic static int CreateProcess(string path, string[] arguments, bool openConsole = false);Creates a new process that runs independently of Reckfell. It will not terminate when Reckfell terminates. The path specified in path must exist and be an executable file or macOS .app bundle. The path is resolved based on the current platform. The arguments are used in the given order and separated by a space.
On Windows, if open_console is true and the process is a console app, a new terminal window will be opened.
If the process is successfully created, this method returns its process ID, which you can use to monitor the process (and potentially terminate it with OS.Kill). Otherwise, this method returns -1.
Example: Run another instance of the project:
var pid = OS.CreateProcess(OS.GetExecutablePath(), []);See OS.Execute if you wish to run an external command and retrieve the results.
Note: This method is implemented on Android, Linux, macOS, and Windows.
Note: On macOS, sandboxed applications are limited to run only embedded helper executables, specified during export or system .app bundle, system .app bundles will ignore arguments.
| Name | Type | Default |
|---|---|---|
path | string | — |
arguments | string[] | — |
openConsole | bool | false |
intDelayMsecvoid
public static void DelayMsec(int msec);Delays execution of the current thread by msec milliseconds. msec must be greater than or equal to 0. Otherwise, OS.DelayMsec does nothing and prints an error message.
Note: OS.DelayMsec is a blocking way to delay code execution. To delay code execution in a non-blocking way, you may use EntityTree.CreateTimer. Awaiting with EntityTreeTimer delays the execution of code placed below the await without affecting the rest of the project (or editor, for EditorPlugins and EditorScripts).
Note: When OS.DelayMsec is called on the main thread, it will freeze the project and will prevent it from redrawing and registering input until the delay has passed. When using OS.DelayMsec as part of an EditorPlugin or EditorScript, it will freeze the editor but won't freeze the project if it is currently running (since the project is an independent child process).
| Name | Type | Default |
|---|---|---|
msec | int | — |
DelayUsecvoid
public static void DelayUsec(int usec);Delays execution of the current thread by usec microseconds. usec must be greater than or equal to 0. Otherwise, OS.DelayUsec does nothing and prints an error message.
Note: OS.DelayUsec is a blocking way to delay code execution. To delay code execution in a non-blocking way, you may use EntityTree.CreateTimer. Awaiting with a EntityTreeTimer delays the execution of code placed below the await without affecting the rest of the project (or editor, for EditorPlugins and EditorScripts).
Note: When OS.DelayUsec is called on the main thread, it will freeze the project and will prevent it from redrawing and registering input until the delay has passed. When using OS.DelayUsec as part of an EditorPlugin or EditorScript, it will freeze the editor but won't freeze the project if it is currently running (since the project is an independent child process).
| Name | Type | Default |
|---|---|---|
usec | int | — |
Execute2 overloads
public static int Execute(string path, ReadOnlySpan<string> arguments, Reckfell.Collections.Array output, bool readStderr, bool openConsole);Executes the given process in a blocking way. The file specified in path must exist and be executable. The system path resolution will be used. The arguments are used in the given order, separated by spaces, and wrapped in quotes.
If an output array is provided, the complete shell output of the process is appended to output as a single string element. If read_stderr is true, the output to the standard error stream is also appended to the array.
On Windows, if open_console is true and the process is a console app, a new terminal window is opened.
This method returns the exit code of the command, or -1 if the process fails to execute.
Note: The main thread will be blocked until the executed command terminates. Use ReckfellThread to create a separate thread that will not block the main thread, or use OS.CreateProcess to create a completely independent process.
For example, to retrieve a list of the working directory's contents:
Reckfell.Collections.Array output = [];
int exitCode = OS.Execute("ls", ["-l", "/tmp"], output);If you wish to access a shell built-in or execute a composite command, a platform-specific shell can be invoked. For example:
Reckfell.Collections.Array output = [];
OS.Execute("CMD.exe", ["/C", "cd %TEMP% && dir"], output);Note: This method is implemented on Android, Linux, macOS, and Windows.
Note: To execute a Windows command interpreter built-in command, specify cmd.exe in path, /c as the first argument, and the desired command as the second argument.
Note: To execute a PowerShell built-in command, specify powershell.exe in path, -Command as the first argument, and the desired command as the second argument.
Note: To execute a Unix shell built-in command, specify shell executable name in path, -c as the first argument, and the desired command as the second argument.
Note: On macOS, sandboxed applications are limited to run only embedded helper executables, specified during export.
Note: On Android, system commands such as dumpsys can only be run on a rooted device.
| Name | Type | Default |
|---|---|---|
path | string | — |
arguments | ReadOnlySpan<string> | — |
output | Reckfell.Collections.Array | — |
readStderr | bool | — |
openConsole | bool | — |
intpublic static int Execute(string path, string[] arguments, Reckfell.Collections.Array output = null, bool readStderr = false, bool openConsole = false);Executes the given process in a blocking way. The file specified in path must exist and be executable. The system path resolution will be used. The arguments are used in the given order, separated by spaces, and wrapped in quotes.
If an output array is provided, the complete shell output of the process is appended to output as a single string element. If read_stderr is true, the output to the standard error stream is also appended to the array.
On Windows, if open_console is true and the process is a console app, a new terminal window is opened.
This method returns the exit code of the command, or -1 if the process fails to execute.
Note: The main thread will be blocked until the executed command terminates. Use ReckfellThread to create a separate thread that will not block the main thread, or use OS.CreateProcess to create a completely independent process.
For example, to retrieve a list of the working directory's contents:
Reckfell.Collections.Array output = [];
int exitCode = OS.Execute("ls", ["-l", "/tmp"], output);If you wish to access a shell built-in or execute a composite command, a platform-specific shell can be invoked. For example:
Reckfell.Collections.Array output = [];
OS.Execute("CMD.exe", ["/C", "cd %TEMP% && dir"], output);Note: This method is implemented on Android, Linux, macOS, and Windows.
Note: To execute a Windows command interpreter built-in command, specify cmd.exe in path, /c as the first argument, and the desired command as the second argument.
Note: To execute a PowerShell built-in command, specify powershell.exe in path, -Command as the first argument, and the desired command as the second argument.
Note: To execute a Unix shell built-in command, specify shell executable name in path, -c as the first argument, and the desired command as the second argument.
Note: On macOS, sandboxed applications are limited to run only embedded helper executables, specified during export.
Note: On Android, system commands such as dumpsys can only be run on a rooted device.
| Name | Type | Default |
|---|---|---|
path | string | — |
arguments | string[] | — |
output | Reckfell.Collections.Array | null |
readStderr | bool | false |
openConsole | bool | false |
intExecuteWithPipe4 overloads
public static Reckfell.Collections.Dictionary ExecuteWithPipe(string path, ReadOnlySpan<string> arguments);Creates a new process that runs independently of Reckfell with redirected IO. It will not terminate when Reckfell terminates. The path specified in path must exist and be an executable file or macOS .app bundle. The path is resolved based on the current platform. The arguments are used in the given order and separated by a space.
If blocking is false, created pipes work in non-blocking mode, i.e. read and write operations will return immediately. Use FileAccess.GetError to check if the last read/write operation was successful.
If the process cannot be created, this method returns an empty Reckfell.Collections.Dictionary. Otherwise, this method returns a Reckfell.Collections.Dictionary with the following keys:
"stdio"-FileAccessto access the process stdin and stdout pipes (read/write)."stderr"-FileAccessto access the process stderr pipe (read only)."pid"- Process ID as anOS.Kill). Note: This method is implemented on Android, Linux, macOS, and Windows. Note: To execute a Windows command interpreter built-in command, specifycmd.exeinpath,/cas the first argument, and the desired command as the second argument. Note: To execute a PowerShell built-in command, specifypowershell.exeinpath,-Commandas the first argument, and the desired command as the second argument. Note: To execute a Unix shell built-in command, specify shell executable name inpath,-cas the first argument, and the desired command as the second argument. Note: On macOS, sandboxed applications are limited to run only embedded helper executables, specified during export or system .app bundle, system .app bundles will ignore arguments.
| Name | Type | Default |
|---|---|---|
path | string | — |
arguments | ReadOnlySpan<string> | — |
Reckfell.Collections.Dictionarypublic static Reckfell.Collections.Dictionary ExecuteWithPipe(string path, ReadOnlySpan<string> arguments, bool blocking);Creates a new process that runs independently of Reckfell with redirected IO. It will not terminate when Reckfell terminates. The path specified in path must exist and be an executable file or macOS .app bundle. The path is resolved based on the current platform. The arguments are used in the given order and separated by a space.
If blocking is false, created pipes work in non-blocking mode, i.e. read and write operations will return immediately. Use FileAccess.GetError to check if the last read/write operation was successful.
If the process cannot be created, this method returns an empty Reckfell.Collections.Dictionary. Otherwise, this method returns a Reckfell.Collections.Dictionary with the following keys:
"stdio"-FileAccessto access the process stdin and stdout pipes (read/write)."stderr"-FileAccessto access the process stderr pipe (read only)."pid"- Process ID as anOS.Kill). Note: This method is implemented on Android, Linux, macOS, and Windows. Note: To execute a Windows command interpreter built-in command, specifycmd.exeinpath,/cas the first argument, and the desired command as the second argument. Note: To execute a PowerShell built-in command, specifypowershell.exeinpath,-Commandas the first argument, and the desired command as the second argument. Note: To execute a Unix shell built-in command, specify shell executable name inpath,-cas the first argument, and the desired command as the second argument. Note: On macOS, sandboxed applications are limited to run only embedded helper executables, specified during export or system .app bundle, system .app bundles will ignore arguments.
| Name | Type | Default |
|---|---|---|
path | string | — |
arguments | ReadOnlySpan<string> | — |
blocking | bool | — |
Reckfell.Collections.Dictionarypublic static Reckfell.Collections.Dictionary ExecuteWithPipe(string path, string[] arguments);Creates a new process that runs independently of Reckfell with redirected IO. It will not terminate when Reckfell terminates. The path specified in path must exist and be an executable file or macOS .app bundle. The path is resolved based on the current platform. The arguments are used in the given order and separated by a space.
If blocking is false, created pipes work in non-blocking mode, i.e. read and write operations will return immediately. Use FileAccess.GetError to check if the last read/write operation was successful.
If the process cannot be created, this method returns an empty Reckfell.Collections.Dictionary. Otherwise, this method returns a Reckfell.Collections.Dictionary with the following keys:
"stdio"-FileAccessto access the process stdin and stdout pipes (read/write)."stderr"-FileAccessto access the process stderr pipe (read only)."pid"- Process ID as anOS.Kill). Note: This method is implemented on Android, Linux, macOS, and Windows. Note: To execute a Windows command interpreter built-in command, specifycmd.exeinpath,/cas the first argument, and the desired command as the second argument. Note: To execute a PowerShell built-in command, specifypowershell.exeinpath,-Commandas the first argument, and the desired command as the second argument. Note: To execute a Unix shell built-in command, specify shell executable name inpath,-cas the first argument, and the desired command as the second argument. Note: On macOS, sandboxed applications are limited to run only embedded helper executables, specified during export or system .app bundle, system .app bundles will ignore arguments.
| Name | Type | Default |
|---|---|---|
path | string | — |
arguments | string[] | — |
Reckfell.Collections.Dictionarypublic static Reckfell.Collections.Dictionary ExecuteWithPipe(string path, string[] arguments, bool blocking = true);Creates a new process that runs independently of Reckfell with redirected IO. It will not terminate when Reckfell terminates. The path specified in path must exist and be an executable file or macOS .app bundle. The path is resolved based on the current platform. The arguments are used in the given order and separated by a space.
If blocking is false, created pipes work in non-blocking mode, i.e. read and write operations will return immediately. Use FileAccess.GetError to check if the last read/write operation was successful.
If the process cannot be created, this method returns an empty Reckfell.Collections.Dictionary. Otherwise, this method returns a Reckfell.Collections.Dictionary with the following keys:
"stdio"-FileAccessto access the process stdin and stdout pipes (read/write)."stderr"-FileAccessto access the process stderr pipe (read only)."pid"- Process ID as anOS.Kill). Note: This method is implemented on Android, Linux, macOS, and Windows. Note: To execute a Windows command interpreter built-in command, specifycmd.exeinpath,/cas the first argument, and the desired command as the second argument. Note: To execute a PowerShell built-in command, specifypowershell.exeinpath,-Commandas the first argument, and the desired command as the second argument. Note: To execute a Unix shell built-in command, specify shell executable name inpath,-cas the first argument, and the desired command as the second argument. Note: On macOS, sandboxed applications are limited to run only embedded helper executables, specified during export or system .app bundle, system .app bundles will ignore arguments.
| Name | Type | Default |
|---|---|---|
path | string | — |
arguments | string[] | — |
blocking | bool | true |
Reckfell.Collections.DictionaryFindKeycodeFromStringKey
public static Key FindKeycodeFromString(string @string);Finds the keycode for the given string. The returned values are equivalent to the Key constants.
ReckfellApi.Print(OS.FindKeycodeFromString("C")); // Prints C (Key.C)
ReckfellApi.Print(OS.FindKeycodeFromString("Escape")); // Prints Escape (Key.Escape)
ReckfellApi.Print(OS.FindKeycodeFromString("Shift+Tab")); // Prints 37748738 (KeyModifierMask.MaskShift | Key.Tab)
ReckfellApi.Print(OS.FindKeycodeFromString("Unknown")); // Prints None (Key.None)See also OS.GetKeycodeString.
| Name | Type | Default |
|---|---|---|
string | string | — |
KeyGetCacheDirstring
public static string GetCacheDir();Returns the global cache data directory according to the operating system's standards.
On the Linux/BSD platform, this path can be overridden by setting the XDG_CACHE_HOME environment variable before starting the project. See File paths in Reckfell projects in the documentation for more information. See also OS.GetConfigDir and OS.GetDataDir.
Not to be confused with OS.GetUserDataDir, which returns the project-specific user data path.
stringGetCmdlineArgsstring[]
public static string[] GetCmdlineArgs();Returns engine arguments supplied to this process, excluding the user tail after -- or ++. Use GetCmdlineUserArgs for game arguments.
string[]Array of engine argument strings. User arguments after the separator are excluded.
GetCmdlineUserArgsstring[]
public static string[] GetCmdlineUserArgs();Returns arguments after the -- or ++ separator in their original order. The engine does not interpret them: --headless in this tail is a game argument rather than a display option.
string[]User argument array; empty when no user tail was supplied. A value containing spaces remains one element if the shell passed it as one argument.
GetConfigDirstring
public static string GetConfigDir();Returns the global user configuration directory according to the operating system's standards.
On the Linux/BSD platform, this path can be overridden by setting the XDG_CONFIG_HOME environment variable before starting the project. See File paths in Reckfell projects in the documentation for more information. See also OS.GetCacheDir and OS.GetDataDir.
Not to be confused with OS.GetUserDataDir, which returns the project-specific user data path.
stringGetConnectedMidiInputsstring[]
public static string[] GetConnectedMidiInputs();Returns an array of connected MIDI device names, if they exist. Returns an empty array if the system MIDI driver has not previously been initialized with OS.OpenMidiInputs. See also OS.CloseMidiInputs.
Note: This method is implemented on Linux, macOS, Windows, and Web.
Note: On the Web platform, Web MIDI needs to be supported by the browser. For the time being, it is currently supported by all major browsers, except Safari.
Note: On the Web platform, using MIDI input requires a browser permission to be granted first. This permission request is performed when calling OS.OpenMidiInputs. The browser will refrain from processing MIDI input until the user accepts the permission request.
string[]GetDataDirstring
public static string GetDataDir();Returns the global user data directory according to the operating system's standards.
On the Linux/BSD platform, this path can be overridden by setting the XDG_DATA_HOME environment variable before starting the project. See File paths in Reckfell projects in the documentation for more information. See also OS.GetCacheDir and OS.GetConfigDir.
Not to be confused with OS.GetUserDataDir, which returns the project-specific user data path.
stringGetDistributionNamestring
public static string GetDistributionName();Returns the name of the distribution for Linux and BSD platforms (e.g. "Ubuntu", "Manjaro", "OpenBSD", etc.).
Returns the same value as OS.GetName for stock Android ROMs, but attempts to return the custom ROM name for popular Android derivatives such as "LineageOS".
Returns the same value as OS.GetName for other platforms.
Note: This method is not supported on the Web platform. It returns an empty string.
stringGetEntropybyte[]
public static byte[] GetEntropy(int size);Generates a byte[] of cryptographically secure random bytes with given size.
Note: Generating large quantities of bytes using this method can result in locking and entropy of lower quality on most platforms. Using Crypto.GenerateRandomBytes is preferred in most cases.
| Name | Type | Default |
|---|---|---|
size | int | — |
byte[]GetEnvironmentstring
public static string GetEnvironment(string variable);Returns the value of the given environment variable, or an empty string if variable doesn't exist.
Note: Double-check the casing of variable. Environment variable names are case-sensitive on all platforms except Windows.
Note: On macOS, applications do not have access to shell environment variables.
| Name | Type | Default |
|---|---|---|
variable | string | — |
stringGetExecutablePathstring
public static string GetExecutablePath();Returns the file path to the current engine executable.
Note: On macOS, if you want to launch another instance of Reckfell, always use OS.CreateInstance instead of relying on the executable path.
stringGetGrantedPermissionsstring[]
public static string[] GetGrantedPermissions();On Android devices: Returns the list of dangerous permissions that have been granted. On macOS: Returns the list of granted permissions and user selected folders accessible to the application (sandboxed applications only). Use the native file dialog to request folder access permission. On iOS, visionOS: Returns the list of granted permissions.
string[]GetKeycodeStringstring
public static string GetKeycodeString(Key code);Returns the given keycode as a string.
ReckfellApi.Print(OS.GetKeycodeString(Key.C)); // Prints "C"
ReckfellApi.Print(OS.GetKeycodeString(Key.Escape)); // Prints "Escape"
ReckfellApi.Print(OS.GetKeycodeString((Key)KeyModifierMask.MaskShift | Key.Tab)); // Prints "Shift+Tab"See also OS.FindKeycodeFromString, InputEventKey.Keycode, and InputEventKey.GetKeycodeWithModifiers.
| Name | Type | Default |
|---|---|---|
code | Key | — |
stringGetLocalestring
public static string GetLocale();Returns the host OS locale as a string of the form language_Script_COUNTRY_VARIANT@extra. Every substring after language is optional and may not exist.
language- 2 or 3-letter language code, in lower case.- [code skip-lint]Script` - 4-letter script code, in title case.
COUNTRY- 2 or 3-letter country code, in upper case.VARIANT- language variant, region, and sort order. The variant can have any number of underscored keywords.extra- semicolon separated list of additional key words. This may include currency, calendar, sort order, and numbering system information. If you want only the language code and not the fully specified locale from the OS, you can useOS.GetLocaleLanguage.
stringGetLocaleLanguagestring
public static string GetLocaleLanguage();Returns the host OS locale's 2 or 3-letter language code as a string which should be consistent on all platforms. This is equivalent to extracting the language part of the OS.GetLocale string.
This can be used to narrow down fully specified locale strings to only the "common" language code, when you don't need the additional information about country code or variants. For example, for a French Canadian user with fr_CA locale, this would return fr.
stringGetLowProcessorUsageModeSleepUsecint
public static int GetLowProcessorUsageModeSleepUsec();intGetMainThreadIdulong
public static ulong GetMainThreadId();Returns the ID of the main thread. See OS.GetThreadCallerId.
Note: Thread IDs are not deterministic and may be reused across application restarts.
ulongGetMemoryInfoReckfell.Collections.Dictionary
public static Reckfell.Collections.Dictionary GetMemoryInfo();Returns a Reckfell.Collections.Dictionary containing information about the current memory with the following entries:
"physical"- total amount of usable physical memory in bytes. This value can be slightly less than the actual physical memory amount, since it does not include memory reserved by the kernel and devices."free"- amount of physical memory, that can be immediately allocated without disk access or other costly operations, in bytes. The process might be able to allocate more physical memory, but this action will require moving inactive pages to disk, which can be expensive."available"- amount of memory that can be allocated without extending the swap file(s), in bytes. This value includes both physical memory and swap."stack"- size of the current thread stack in bytes. Note: Each entry's value may be-1if it is unknown.
Reckfell.Collections.DictionaryGetModelNamestring
public static string GetModelName();Returns the model name of the current device.
Note: This method is implemented on Android, iOS, macOS, and Windows. Returns "GenericDevice" on unsupported platforms.
stringGetNamestring
public static string GetName();Returns the name of the host platform.
- On Windows, this is
"Windows". - On macOS, this is
"macOS". - On Linux-based operating systems, this is
"Linux". - On BSD-based operating systems, this is
"FreeBSD","NetBSD","OpenBSD", or"BSD"as a fallback. - On Android, this is
"Android". - On iOS, this is
"iOS". - On Web, this is
"Web". Note: Custom builds of the engine may support additional platforms, such as consoles, possibly returning other names.
switch (OS.GetName())
{
case "Windows":
ReckfellApi.Print("Welcome to Windows");
break;
case "macOS":
ReckfellApi.Print("Welcome to macOS!");
break;
case "Linux":
case "FreeBSD":
case "NetBSD":
case "OpenBSD":
case "BSD":
ReckfellApi.Print("Welcome to Linux/BSD!");
break;
case "Android":
ReckfellApi.Print("Welcome to Android!");
break;
case "iOS":
ReckfellApi.Print("Welcome to iOS!");
break;
case "Web":
ReckfellApi.Print("Welcome to the Web!");
break;
}Note: On Web platforms, it is still possible to determine the host platform's OS with feature tags. See OS.HasFeature.
stringGetPreferredLocalesstring[]
public static string[] GetPreferredLocales();Returns an array of locales preferred by the user, in order of preference. Each locale is as a string on the form language_Script_COUNTRY_VARIANT@extra. Every substring after language is optional and may not exist.
language- 2 or 3-letter language code, in lower case.- [code skip-lint]Script` - 4-letter script code, in title case.
COUNTRY- 2 or 3-letter country code, in upper case.VARIANT- language variant, region, and sort order. The variant can have any number of underscored keywords.extra- semicolon separated list of additional key words. This may include currency, calendar, sort order, and numbering system information. Note: This method is implemented on macOS, iOS, and Windows.
string[]GetProcessExitCodeint
public static int GetProcessExitCode(int pid);Returns the exit code of a spawned process once it has finished running (see OS.IsProcessRunning).
Returns -1 if the pid is not a PID of a spawned child process, the process is still running, or the method is not implemented for the current platform.
Note: Returns -1 if the pid is a macOS bundled app process.
Note: This method is implemented on Android, Linux, macOS and Windows.
| Name | Type | Default |
|---|---|---|
pid | int | — |
intGetProcessIdint
public static int GetProcessId();Returns the number used by the host machine to uniquely identify this application.
Note: On Web, this method always returns 0.
intGetProcessorCountint
public static int GetProcessorCount();Returns the number of logical CPU cores available on the host machine. On CPUs with HyperThreading enabled, this number will be greater than the number of physical CPU cores.
intGetProcessorNamestring
public static string GetProcessorName();Returns the full name of the CPU model on the host machine (e.g. "Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz").
Note: This method is only implemented on Windows, macOS, Linux, Android (API level 31+), and iOS. On Web, OS.GetProcessorName returns an empty string.
stringGetRestartOnExitArgumentsstring[]
public static string[] GetRestartOnExitArguments();Returns the list of command line arguments that will be used when the project automatically restarts using OS.SetRestartOnExit. See also OS.IsRestartOnExitSet.
string[]GetStaticMemoryPeakUsageulong
public static ulong GetStaticMemoryPeakUsage();Returns the maximum amount of static memory used. Only works in debug builds.
ulongGetStaticMemoryUsageulong
public static ulong GetStaticMemoryUsage();Returns the amount of static memory being used by the program in bytes. Only works in debug builds.
ulongGetStdInTypeOS.StdHandleType
public static OS.StdHandleType GetStdInType();Returns the type of the standard input device.
Note: This method is implemented on Linux, macOS, and Windows.
Note: On exported Windows builds, run the console wrapper executable to access the standard input. If you need a single executable with full console support, use a custom build compiled with the windows_subsystem=console flag.
OS.StdHandleTypeGetStdOutTypeOS.StdHandleType
public static OS.StdHandleType GetStdOutType();Returns the type of the standard output device. Note: This method is implemented on Linux, macOS, and Windows.
OS.StdHandleTypeGetStderrTypeOS.StdHandleType
public static OS.StdHandleType GetStderrType();Returns the type of the standard error device. Note: This method is implemented on Linux, macOS, and Windows.
OS.StdHandleTypeGetSystemCaCertificatesstring
public static string GetSystemCaCertificates();Returns the list of certification authorities trusted by the operating system as a string of concatenated certificates in PEM format.
stringGetSystemDirstring
public static string GetSystemDir(OS.SystemDir dir, bool sharedStorage = true);Returns the path to commonly used folders across different platforms, as defined by dir. See the OS.SystemDir constants for available locations.
Note: This method is implemented on Android, Linux, macOS and Windows.
Note: Shared storage is implemented on Android and allows to differentiate between app specific and shared directories, if shared_storage is true. Shared directories have additional restrictions on Android.
| Name | Type | Default |
|---|---|---|
dir | OS.SystemDir | — |
sharedStorage | bool | true |
stringGetSystemFontPathstring
public static string GetSystemFontPath(string fontName, int weight = 400, int stretch = 100, bool italic = false);Returns the path to the system font file with font_name and style. Returns an empty string if no matching fonts found.
The following aliases can be used to request default fonts: "sans-serif", "serif", "monospace", "cursive", and "fantasy".
Note: Returned font might have different style if the requested style is not available.
Note: This method is implemented on Android, iOS, Linux, macOS and Windows.
| Name | Type | Default |
|---|---|---|
fontName | string | — |
weight | int | 400 |
stretch | int | 100 |
italic | bool | false |
stringGetSystemFontPathForTextstring[]
public static string[] GetSystemFontPathForText(string fontName, string text, string locale = "", string script = "", int weight = 400, int stretch = 100, bool italic = false);Returns an array of the system substitute font file paths, which are similar to the font with font_name and style for the specified text, locale, and script. Returns an empty array if no matching fonts found.
The following aliases can be used to request default fonts: "sans-serif", "serif", "monospace", "cursive", and "fantasy".
Note: Depending on OS, it's not guaranteed that any of the returned fonts will be suitable for rendering specified text. Fonts should be loaded and checked in the order they are returned, and the first suitable one used.
Note: Returned fonts might have different style if the requested style is not available or belong to a different font family.
Note: This method is implemented on Android, iOS, Linux, macOS and Windows.
| Name | Type | Default |
|---|---|---|
fontName | string | — |
text | string | — |
locale | string | "" |
script | string | "" |
weight | int | 400 |
stretch | int | 100 |
italic | bool | false |
string[]GetSystemFontsstring[]
public static string[] GetSystemFonts();Returns the list of font family names available. Note: This method is implemented on Android, iOS, Linux, macOS and Windows.
string[]GetTempDirstring
public static string GetTempDir();Returns the global temporary data directory according to the operating system's standards.
stringGetThreadCallerIdulong
public static ulong GetThreadCallerId();Returns the ID of the current thread. This can be used in logs to ease debugging of multi-threaded applications. Note: Thread IDs are not deterministic and may be reused across application restarts.
ulongGetUniqueIdstring
public static string GetUniqueId();Returns a string that is unique to the device. Note: This string may change without notice if the user reinstalls their operating system, upgrades it, or modifies their hardware. This means it should generally not be used to encrypt persistent data, as the data saved before an unexpected ID change would become inaccessible. The returned string may also be falsified using external programs, so do not rely on the string returned by this method for security purposes. Note: On Web, returns an empty string and generates an error, as this method cannot be implemented for security reasons.
stringGetUserDataDirstring
public static string GetUserDataDir();Returns the absolute directory path where user data is written (the user:// directory in Reckfell). The path depends on the project name and ProjectSettings.application/config/use_custom_user_dir.
- On Windows, this is
%AppData%\Reckfell\app_userdata\[project_name], or%AppData%\[custom_name]ifuse_custom_user_diris set.%AppData%expands to%UserProfile%\AppData\Roaming. - On macOS, this is
~/Library/Application Support/Reckfell/app_userdata/[project_name], or~/Library/Application Support/[custom_name]ifuse_custom_user_diris set. - On Linux and BSD, this is
~/.local/share/reckfell/app_userdata/[project_name], or~/.local/share/[custom_name]ifuse_custom_user_diris set. - On Android and iOS, this is a sandboxed directory in either internal or external storage, depending on the user's configuration.
- On Web, this is a virtual directory managed by the browser.
If the project name is empty,
[project_name]falls back to[unnamed project]. Not to be confused withOS.GetDataDir, which returns the global (non-project-specific) user home directory.
stringGetVersionstring
public static string GetVersion();Returns the exact production and build version of the operating system. This is different from the branded version used in marketing. This helps to distinguish between different releases of operating systems, including minor versions, and insider and custom builds.
- For Windows, the major and minor version are returned, as well as the build number. For example, the returned string may look like
10.0.9926for a build of Windows 10. - For rolling distributions, such as Arch Linux, an empty string is returned.
- For macOS and iOS, the major and minor version are returned, as well as the patch number.
- For Android, the SDK version and the incremental build number are returned. If it's a custom ROM, it attempts to return its version instead. Note: This method is not supported on the Web platform. It returns an empty string.
stringGetVersionAliasstring
public static string GetVersionAlias();Returns the branded version used in marketing, followed by the build number (on Windows), the version number (on macOS), or the SDK version and incremental build number (on Android). Examples include 11 (build 22000), Sequoia (15.0.0), and 15 (SDK 35 build abc528-11988f).
This value can then be appended to OS.GetName to get a full, human-readable operating system name and version combination for the operating system. Windows feature updates such as 24H2 are not contained in the resulting string, but Windows Server is recognized as such (e.g. 2025 (build 26100) for Windows Server 2025).
Note: This method is only supported on Windows, macOS, and Android. On other operating systems, it returns the same value as OS.GetVersion.
stringGetVideoAdapterDriverInfostring[]
public static string[] GetVideoAdapterDriverInfo();Returns the video adapter driver name and version for the user's currently active graphics card, as a string[]. See also RenderingServer.GetVideoAdapterApiVersion.
The first element holds the driver name, such as nvidia, amdgpu, etc.
The second element holds the driver version. For example, on the nvidia driver on a Linux/BSD platform, the version is in the format 510.85.02. For Windows, the driver's format is 31.0.15.1659.
Note: This method is only supported on Linux/BSD and Windows when not running in headless mode. On other platforms, it returns an empty array.
Note: This method will run slowly the first time it is called in a session; it can take several seconds depending on the operating system and hardware. It is blocking if called on the main thread, so it's recommended to call it on a separate thread using ReckfellThread. This allows the engine to keep running while the information is being retrieved. However, OS.GetVideoAdapterDriverInfo is not thread-safe, so it should not be called from multiple threads at the same time.
string[]HasEnvironmentbool
public static bool HasEnvironment(string variable);Returns true if the environment variable with the name variable exists.
Note: Double-check the casing of variable. Environment variable names are case-sensitive on all platforms except Windows.
| Name | Type | Default |
|---|---|---|
variable | string | — |
boolHasFeaturebool
public static bool HasFeature(string tagName);Checks an exact build, platform or custom feature tag. Names are case-sensitive. editor identifies an editor build and remains true during project execution; editor_runtime distinguishes that execution from editor use. application/config/features does not register custom tags.
| Name | Type | Default |
|---|---|---|
tagName | string | — |
tagNameExact tag name, such as windows, editor_runtime or demo. Windows does not match windows.
booltrue when the tag is active in the current process; false for an unknown or inactive tag.
IsDebugBuildbool
public static bool IsDebugBuild();Returns true if the Reckfell binary used to run the project is a debug export template, or when running in the editor.
Returns false if the Reckfell binary used to run the project is a release export template.
Note: To check whether the Reckfell binary used to run the project is an export template (debug or release), use OS.has_feature("template") instead.
boolIsDeltaSmoothingEnabledbool
public static bool IsDeltaSmoothingEnabled();boolIsInLowProcessorUsageModebool
public static bool IsInLowProcessorUsageMode();boolIsKeycodeUnicodebool
public static bool IsKeycodeUnicode(long code);Returns true if the input keycode corresponds to a Unicode character. For a list of codes, see the Key constants.
ReckfellApi.Print(OS.IsKeycodeUnicode((long)Key.G)); // Prints True
ReckfellApi.Print(OS.IsKeycodeUnicode((long)Key.Kp4)); // Prints True
ReckfellApi.Print(OS.IsKeycodeUnicode((long)Key.Tab)); // Prints False
ReckfellApi.Print(OS.IsKeycodeUnicode((long)Key.Escape)); // Prints False| Name | Type | Default |
|---|---|---|
code | long | — |
boolIsProcessRunningbool
public static bool IsProcessRunning(int pid);Returns true if the child process ID (pid) is still running or false if it has terminated. pid must be a valid ID generated from OS.CreateProcess.
Note: This method is implemented on Android, iOS, Linux, macOS, and Windows.
| Name | Type | Default |
|---|---|---|
pid | int | — |
boolIsRestartOnExitSetbool
public static bool IsRestartOnExitSet();Returns true if the project will automatically restart when it exits for any reason, false otherwise. See also OS.SetRestartOnExit and OS.GetRestartOnExitArguments.
boolIsSandboxedbool
public static bool IsSandboxed();Returns true if the application is running in the sandbox.
Note: This method is only implemented on macOS and Linux.
boolIsStdOutVerbosebool
public static bool IsStdOutVerbose();Returns true if the engine was executed with the --verbose or -v command line argument, or if ProjectSettings.debug/settings/stdout/verbose_stdout is true. See also @GlobalScope.print_verbose.
boolIsUserfsPersistentbool
public static bool IsUserfsPersistent();Returns true if the user:// file system is persistent, that is, its state is the same after a player quits and starts the game again. Relevant to the Web platform, where this persistence may be unavailable.
boolKillError
public static Error Kill(int pid);Kill (terminate) the process identified by the given process ID (pid), such as the ID returned by OS.Execute in non-blocking mode. See also OS.Crash.
Note: This method can also be used to kill processes that were not spawned by the engine.
Note: This method is implemented on Android, iOS, Linux, macOS and Windows.
| Name | Type | Default |
|---|---|---|
pid | int | — |
ErrorMoveToTrashError
public static Error MoveToTrash(string path);Moves the file or directory at the given path to the system's recycle bin. See also DirAccess.Remove.
The method takes only global paths, so you may need to use ProjectSettings.GlobalizePath. Do not use it for files in asset:// as it will not work in exported projects.
Returns FAILED if the file or directory cannot be found, or the system does not support this method.
var fileToRemove = "user://slot1.save";
OS.MoveToTrash(ProjectSettings.GlobalizePath(fileToRemove));Note: This method is implemented on Android, Linux, macOS and Windows. Note: If the user has disabled the recycle bin on their system, the file will be permanently deleted instead.
| Name | Type | Default |
|---|---|---|
path | string | — |
ErrorOpenMidiInputsvoid
public static void OpenMidiInputs();Initializes the singleton for the system MIDI driver, allowing Reckfell to receive InputEventMidi. See also OS.GetConnectedMidiInputs and OS.CloseMidiInputs.
Note: This method is implemented on Linux, macOS, Windows, and Web.
Note: On the Web platform, Web MIDI needs to be supported by the browser. For the time being, it is currently supported by all major browsers, except Safari.
Note: On the Web platform, using MIDI input requires a browser permission to be granted first. This permission request is performed when calling OS.OpenMidiInputs. The browser will refrain from processing MIDI input until the user accepts the permission request.
OpenWithProgram2 overloads
public static Error OpenWithProgram(string programPath, ReadOnlySpan<string> paths);Opens one or more files/directories with the specified application. The program_path specifies the path to the application to use for opening the files, and paths contains an array of file/directory paths to open.
Note: This method is mostly only relevant for macOS, where opening files using OS.CreateProcess might fail. On other platforms, this falls back to using OS.CreateProcess.
Note: On macOS, program_path should ideally be the path to a .app bundle.
| Name | Type | Default |
|---|---|---|
programPath | string | — |
paths | ReadOnlySpan<string> | — |
Errorpublic static Error OpenWithProgram(string programPath, string[] paths);Opens one or more files/directories with the specified application. The program_path specifies the path to the application to use for opening the files, and paths contains an array of file/directory paths to open.
Note: This method is mostly only relevant for macOS, where opening files using OS.CreateProcess might fail. On other platforms, this falls back to using OS.CreateProcess.
Note: On macOS, program_path should ideally be the path to a .app bundle.
| Name | Type | Default |
|---|---|---|
programPath | string | — |
paths | string[] | — |
ErrorReadBufferFromStdInbyte[]
public static byte[] ReadBufferFromStdIn(long bufferSize = 1024);Reads a user input as raw data from the standard input. This operation can be blocking, which causes the window to freeze if OS.ReadBufferFromStdIn is called on the main thread.
- If standard input is console, this method will block until the program receives a line break in standard input (usually by the user pressing [kbd]Enter[/kbd]).
- If standard input is pipe, this method will block until a specific amount of data is read or pipe is closed.
- If standard input is a file, this method will read a specific amount of data (or less if end-of-file is reached) and return immediately.
Note: This method is implemented on Linux, macOS, and Windows.
Note: On exported Windows builds, run the console wrapper executable to access the terminal. If standard input is console, calling this method without console wrapped will freeze permanently. If standard input is pipe or file, it can be used without console wrapper. If you need a single executable with full console support, use a custom build compiled with the
windows_subsystem=consoleflag.
| Name | Type | Default |
|---|---|---|
bufferSize | long | 1024 |
byte[]ReadStringFromStdIn2 overloads
public static string ReadStringFromStdIn();Reads a user input as a UTF-8 encoded string from the standard input. This operation can be blocking, which causes the window to freeze if OS.ReadStringFromStdIn is called on the main thread.
- If standard input is console, this method will block until the program receives a line break in standard input (usually by the user pressing [kbd]Enter[/kbd]).
- If standard input is pipe, this method will block until a specific amount of data is read or pipe is closed.
- If standard input is a file, this method will read a specific amount of data (or less if end-of-file is reached) and return immediately.
Note: This method automatically replaces
\r\nline breaks with\nand removes them from the end of the string. UseOS.ReadBufferFromStdInto read the unprocessed data. Note: This method is implemented on Linux, macOS, and Windows. Note: On exported Windows builds, run the console wrapper executable to access the terminal. If standard input is console, calling this method without console wrapped will freeze permanently. If standard input is pipe or file, it can be used without console wrapper. If you need a single executable with full console support, use a custom build compiled with thewindows_subsystem=consoleflag.
stringpublic static string ReadStringFromStdIn(long bufferSize = 1024);Reads a user input as a UTF-8 encoded string from the standard input. This operation can be blocking, which causes the window to freeze if OS.ReadStringFromStdIn is called on the main thread.
- If standard input is console, this method will block until the program receives a line break in standard input (usually by the user pressing [kbd]Enter[/kbd]).
- If standard input is pipe, this method will block until a specific amount of data is read or pipe is closed.
- If standard input is a file, this method will read a specific amount of data (or less if end-of-file is reached) and return immediately.
Note: This method automatically replaces
\r\nline breaks with\nand removes them from the end of the string. UseOS.ReadBufferFromStdInto read the unprocessed data. Note: This method is implemented on Linux, macOS, and Windows. Note: On exported Windows builds, run the console wrapper executable to access the terminal. If standard input is console, calling this method without console wrapped will freeze permanently. If standard input is pipe or file, it can be used without console wrapper. If you need a single executable with full console support, use a custom build compiled with thewindows_subsystem=consoleflag.
| Name | Type | Default |
|---|---|---|
bufferSize | long | 1024 |
stringRemoveLoggervoid
public static void RemoveLogger(Logger logger);Remove a custom logger added by OS.AddLogger.
| Name | Type | Default |
|---|---|---|
logger | Logger | — |
RequestPermissionbool
public static bool RequestPermission(string name);Requests permission from the OS for the given name. Returns true if the permission has already been granted. See also MainLoop.OnRequestPermissionsResult.
The name must be the full permission name. For example:
OS.request_permission("android.permission.READ_EXTERNAL_STORAGE")OS.request_permission("android.permission.POST_NOTIFICATIONS")OS.request_permission("macos.permission.RECORD_SCREEN")OS.request_permission("appleembedded.permission.AUDIO_RECORD")Note: On Android, permission must be checked during export. Note: This method is implemented on Android, macOS, and visionOS platforms.
| Name | Type | Default |
|---|---|---|
name | string | — |
boolRequestPermissionsbool
public static bool RequestPermissions();Requests dangerous permissions from the OS. Returns true if permissions have already been granted. See also MainLoop.OnRequestPermissionsResult.
Note: Permissions must be checked during export.
Note: This method is only implemented on Android. Normal permissions are automatically granted at install time in Android applications.
boolRevokeGrantedPermissionsvoid
public static void RevokeGrantedPermissions();On macOS (sandboxed applications only), this function clears list of user selected folders accessible to the application.
SetDeltaSmoothingvoid
public static void SetDeltaSmoothing(bool deltaSmoothingEnabled);| Name | Type | Default |
|---|---|---|
deltaSmoothingEnabled | bool | — |
SetEnvironmentvoid
public static void SetEnvironment(string variable, string value);Sets the value of the environment variable variable to value. The environment variable will be set for the Reckfell process and any process executed with OS.Execute after running OS.SetEnvironment. The environment variable will not persist to processes run after the Reckfell process was terminated.
Note: Environment variable names are case-sensitive on all platforms except Windows. The variable name cannot be empty or include the = character. On Windows, there is a 32767 characters limit for the combined length of variable, value, and the = and null terminator characters that will be registered in the environment block.
| Name | Type | Default |
|---|---|---|
variable | string | — |
value | string | — |
SetLowProcessorUsageModevoid
public static void SetLowProcessorUsageMode(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetLowProcessorUsageModeSleepUsecvoid
public static void SetLowProcessorUsageModeSleepUsec(int usec);| Name | Type | Default |
|---|---|---|
usec | int | — |
SetRestartOnExit2 overloads
public static void SetRestartOnExit(bool restart, ReadOnlySpan<string> arguments);If restart is true, restarts the project automatically when it is exited with EntityTree.Quit or Entity.NotificationWMCloseRequest. Command-line arguments can be supplied. To restart the project with the same command line arguments as originally used to run the project, pass OS.GetCmdlineArgs as the value for arguments.
This method can be used to apply setting changes that require a restart. See also OS.IsRestartOnExitSet and OS.GetRestartOnExitArguments.
Note: This method is only effective on desktop platforms, and only when the project isn't started from the editor. It will have no effect on mobile and Web platforms, or when the project is started from the editor.
Note: If the project process crashes or is killed by the user (by sending SIGKILL instead of the usual SIGTERM), the project won't restart automatically.
| Name | Type | Default |
|---|---|---|
restart | bool | — |
arguments | ReadOnlySpan<string> | — |
public static void SetRestartOnExit(bool restart, string[] arguments = null);If restart is true, restarts the project automatically when it is exited with EntityTree.Quit or Entity.NotificationWMCloseRequest. Command-line arguments can be supplied. To restart the project with the same command line arguments as originally used to run the project, pass OS.GetCmdlineArgs as the value for arguments.
This method can be used to apply setting changes that require a restart. See also OS.IsRestartOnExitSet and OS.GetRestartOnExitArguments.
Note: This method is only effective on desktop platforms, and only when the project isn't started from the editor. It will have no effect on mobile and Web platforms, or when the project is started from the editor.
Note: If the project process crashes or is killed by the user (by sending SIGKILL instead of the usual SIGTERM), the project won't restart automatically.
| Name | Type | Default |
|---|---|---|
restart | bool | — |
arguments | string[] | null |
argumentsIf the parameter is null, then the default value is Array.Empty<string>().
SetThreadNameError
public static Error SetThreadName(string name);Assigns the given name to the current thread. Returns ERR_UNAVAILABLE if unavailable on the current platform.
| Name | Type | Default |
|---|---|---|
name | string | — |
ErrorSetUseFileAccessSaveAndSwapvoid
public static void SetUseFileAccessSaveAndSwap(bool enabled);If enabled is true, when opening a file for writing, a temporary file is used in its place. When closed, it is automatically applied to the target file.
This can useful when files may be opened by other applications, such as antiviruses, text editors, or even the Reckfell editor itself.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
ShellOpenError
public static Error ShellOpen(string uri);Requests the OS to open a resource identified by uri with the most appropriate program. For example:
OS.shell_open("C:\\Users\\name\\Downloads")on Windows opens the file explorer at the user's Downloads folder.OS.shell_open("C:/Users/name/Downloads")also works on Windows and opens the file explorer at the user's Downloads folder.OS.shell_open("https://reckfellengine.org")opens the default web browser on the official Reckfell website.OS.shell_open("mailto:example@example.com")opens the default email client with the "To" field set toexample@example.com. See RFC 2368 - The mailto URL scheme for a list of fields that can be added. UseProjectSettings.GlobalizePathto convert aasset://oruser://project path into a system path for use with this method. Note: UseString.uri_encodeto encode characters within URLs in a URL-safe, portable way. This is especially required for line breaks. Otherwise,OS.ShellOpenmay not work correctly in a project exported to the Web platform. Note: This method is implemented on Android, iOS, Web, Linux, macOS and Windows.
| Name | Type | Default |
|---|---|---|
uri | string | — |
ErrorShellShowInFileManagerError
public static Error ShellShowInFileManager(string fileOrDirPath, bool openFolder = true);Requests the OS to open the file manager, navigate to the given file_or_dir_path and select the target file or folder.
If open_folder is true and file_or_dir_path is a valid directory path, the OS will open the file manager and navigate to the target folder without selecting anything.
Use ProjectSettings.GlobalizePath to convert a asset:// or user:// project path into a system path to use with this method.
Note: This method is currently only implemented on Windows and macOS. On other platforms, it will fallback to OS.ShellOpen with a directory path of file_or_dir_path prefixed with file://.
| Name | Type | Default |
|---|---|---|
fileOrDirPath | string | — |
openFolder | bool | true |
ErrorUnsetEnvironmentvoid
public static void UnsetEnvironment(string variable);Removes the given environment variable from the current environment, if it exists. The variable name cannot be empty or include the = character. The environment variable will be removed for the Reckfell process and any process executed with OS.Execute after running OS.UnsetEnvironment. The removal of the environment variable will not persist to processes run after the Reckfell process was terminated.
Note: Environment variable names are case-sensitive on all platforms except Windows.
| Name | Type | Default |
|---|---|---|
variable | string | — |
OS.RenderingDriver
| Value | Description |
|---|---|
D3D12 = 2 | The Direct3D 12 rendering driver. It requires the 12_0 feature level and Shader Model 6.0 support. |
Metal = 3 | The Metal 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. |
Vulkan = 0 | The Vulkan rendering driver. It requires Vulkan 1.0 support and automatically uses features from Vulkan 1.1, 1.2, and 1.3 if available. |
OS.StdHandleType
| Value | Description |
|---|---|
Console = 1 | Standard I/O device is a console. This typically occurs when Reckfell is run from a terminal with no redirection. This is also used for all standard I/O devices when running Reckfell from the editor, at least on desktop platforms. |
File = 2 | Standard I/O device is a regular file. This typically occurs with redirection from a terminal, e.g. |
Invalid = 0 | Standard I/O device is invalid. No data can be received from or sent to these standard I/O devices. |
Pipe = 3 | Standard I/O device is a FIFO/pipe. This typically occurs with pipe usage from a terminal, e.g. |
Unknown = 4 | Standard I/O device type is unknown. |
OS.SystemDir
| Value | Description |
|---|---|
Dcim = 1 | Refers to the DCIM (Digital Camera Images) directory path. |
Desktop = 0 | Refers to the Desktop directory path. |
Documents = 2 | Refers to the Documents directory path. |
Downloads = 3 | Refers to the Downloads directory path. |
Movies = 4 | Refers to the Movies (or Videos) directory path. |
Music = 5 | Refers to the Music directory path. |
Pictures = 6 | Refers to the Pictures directory path. |
Ringtones = 7 | Refers to the Ringtones directory path. |