ProjectSettings
Stores globally-accessible variables.
Stores globally-accessible variables.
Stores variables that can be accessed from everywhere. Use ProjectSettings.GetSetting, ProjectSettings.SetSetting or ProjectSettings.HasSetting to access them. Variables stored in project.reckfell are also loaded into ProjectSettings, making this object very useful for reading custom game configuration options.
When naming a Project Settings property, use the full path to the setting including the category. For example, "application/config/name" for the project name. Category and property names can be viewed in the Project Settings dialog.
Feature tags: Project settings can be overridden for specific platforms and configurations (debug, release, ...) using feature tags.
Overriding: Any project setting can be overridden by creating a file named override.cfg in the project's root directory. This file is in the same format as project.reckfell, and can also be written using ConfigFile. This can also be used in exported projects by placing this file in the same directory as the project binary. Overriding will still take the base project settings' feature tags in account. Therefore, make sure to also override the setting with the desired feature tags if you want them to override base project settings on all platforms and configurations.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Properties1
SingletonProperty
public static ProjectSettingsInstance Singleton { get; }Methods22
AddPropertyInfovoid
public static void AddPropertyInfo(Reckfell.Collections.Dictionary hint);Adds a custom property info to a property. The dictionary must contain:
ProjectSettings.Singleton.Set("category/property_name", 0);
var propertyInfo = new Reckfell.Collections.Dictionary
{
{ "name", "category/propertyName" },
{ "type", (int)Variant.Type.Int },
{ "hint", (int)PropertyHint.Enum },
{ "hint_string", "one,two,three" },
};
ProjectSettings.AddPropertyInfo(propertyInfo);Note: Setting "usage" for the property is not supported. Use ProjectSettings.SetAsBasic, ProjectSettings.SetRestartIfChanged, and ProjectSettings.SetAsInternal to modify usage flags.
| Name | Type | Default |
|---|---|---|
hint | Reckfell.Collections.Dictionary | — |
CheckChangedSettingsInGroupbool
public static bool CheckChangedSettingsInGroup(string settingPrefix);Checks if any settings with the prefix setting_prefix exist in the set of changed settings. See also ProjectSettings.GetChangedSettings.
| Name | Type | Default |
|---|---|---|
settingPrefix | string | — |
boolClearvoid
public static void Clear(string name);Clears the whole configuration (not recommended, may break things).
| Name | Type | Default |
|---|---|---|
name | string | — |
GetChangedSettingsstring[]
public static string[] GetChangedSettings();Gets an array of the settings which have been changed since the last save. Note that internally changed_settings is cleared after a successful save, so generally the most appropriate place to use this method is when processing ProjectSettings.SettingsChanged.
string[]GetGlobalClassListReckfell.Collections.Array<Reckfell.Collections.Dictionary>
public static Reckfell.Collections.Array<Reckfell.Collections.Dictionary> GetGlobalClassList();Returns an Reckfell.Collections.Array of registered global classes. Each global class is represented as a Reckfell.Collections.Dictionary that contains the following entries:
baseis a name of the base class;classis a name of the registered global class;iconis a path to a custom icon of the global class, if it has any;languageis a name of a programming language in which the global class is written;pathis a path to a file containing the global class. Note: Both the script and the icon paths are local to the project filesystem, i.e. they start withasset://.
Reckfell.Collections.Array<Reckfell.Collections.Dictionary>GetOrderint
public static int GetOrder(string name);Returns the order of a configuration value (influences when saved to the config file).
| Name | Type | Default |
|---|---|---|
name | string | — |
intGetSettingVariant
public static Variant GetSetting(string name, Variant defaultValue = default);Reads a base setting value; returns defaultValue without creating a key if it is absent. Does not validate its type or resolve feature overrides. Use GetSettingWithOverride for overrides.
| Name | Type | Default |
|---|---|---|
name | string | — |
defaultValue | Variant | default |
nameFull setting key, such as application/run/max_fps.
defaultValueValue returned for a missing key; does not replace an existing value of the wrong type.
VariantThe stored value or defaultValue as a Variant. Check VariantType before conversion when the data type is not guaranteed.
GetSettingWithOverrideVariant
public static Variant GetSettingWithOverride(StringName name);Reads a setting with active feature-tag overrides. Given game/content_mode and game/content_mode.demo, selects the demo variant when demo is active, otherwise the base value. Unlike GetSetting, resolves the override; this example does not establish priority among multiple active suffixes.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
nameBase setting name without a feature suffix, such as game/content_mode. Define the base setting before reading it.
VariantThe active override or base value as a Variant; convert to the expected type, for example AsString() for a string.
GetSettingWithOverrideAndCustomFeatures2 overloads
public static Variant GetSettingWithOverrideAndCustomFeatures(StringName name, ReadOnlySpan<string> features);Similar to ProjectSettings.GetSettingWithOverride, but applies feature tag overrides instead of current OS features.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
features | ReadOnlySpan<string> | — |
Variantpublic static Variant GetSettingWithOverrideAndCustomFeatures(StringName name, string[] features);Similar to ProjectSettings.GetSettingWithOverride, but applies feature tag overrides instead of current OS features.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
features | string[] | — |
VariantGlobalizePathstring
public static string GlobalizePath(string path);Converts asset://, user:// and supported uid:// paths into OS paths; other strings are left without that conversion. It does not create directories or extract packed resources. Globalize user:// before passing it to System.IO; keep using ResourceLoader for imported assets.
| Name | Type | Default |
|---|---|---|
path | string | — |
stringHasSettingbool
public static bool HasSetting(string name);Tests whether a setting key exists, rather than whether its value has the expected type. Reading a missing key with a GetSetting fallback does not create it.
| Name | Type | Default |
|---|---|---|
name | string | — |
nameFull setting key, such as game/starting_lives.
booltrue for an existing key; false for a missing key or one removed with Variant Nil.
LoadResourcePackbool
public static bool LoadResourcePack(string pack, bool replaceFiles = true, int offset = 0);Mounts a PCK or ZIP into asset://; does not instantiate Entities or load DLLs into .NET. replaceFiles controls ordinary path collisions, but PCK removal entries apply even with false. Already loaded resources are not automatically updated: ordinary ResourceLoader.Load can return the old cached object. Mount updates before their resources are first accessed. A fresh DirAccess can enumerate added paths.
| Name | Type | Default |
|---|---|---|
pack | string | — |
replaceFiles | bool | true |
offset | int | 0 |
packPack file path: absolute, asset:// or user://. Not the internal level path. Successful mounting does not establish that all dependencies are present or that the author is authentic.
replaceFilesDefaults to true: later packs replace ordinary colliding paths. With false, existing paths retain priority and new ones are still added. Does not protect against removal entries or provide a sandbox.
offsetPCK starting offset in bytes; normally 0. Not supported for ZIP. Not an individual resource offset within the pack.
booltrue if the pack is recognized and mounted; false on failure. Does not return an Error or test loading every resource in the pack.
LocalizePathstring
public static string LocalizePath(string path);Converts suitable absolute paths inside the project root into asset://. Absolute paths outside the project generally remain absolute. It is not a general conversion of the user-data directory into user://; retain virtual slot paths explicitly.
| Name | Type | Default |
|---|---|---|
path | string | — |
stringSaveError
public static Error Save();Saves the configuration to the project.reckfell file.
Note: This method is intended to be used by editor plugins, as modified ProjectSettings can't be loaded back in the running app. If you want to change project settings in exported projects, use ProjectSettings.SaveCustom to save an override.cfg file.
ErrorSaveCustomError
public static Error SaveCustom(string file);Saves the current configuration to the supplied path. Values equal to their initial value are omitted; this is not restricted to one custom key and does not reload the file. Player preferences usually belong in a separate ConfigFile under user://.
| Name | Type | Default |
|---|---|---|
file | string | — |
filePath ending in .reckfell or override.cfg for text, or .binary for binary output. An arbitrary .json file is unsupported; the directory must be writable.
ErrorError.Ok on successful writing; otherwise an error code. Check it before reporting that saving succeeded.
SetAsBasicvoid
public static void SetAsBasic(string name, bool basic);Defines if the specified setting is considered basic or advanced. Basic settings will always be shown in the project settings. Advanced settings will only be shown if the user enables the "Advanced Settings" option.
| Name | Type | Default |
|---|---|---|
name | string | — |
basic | bool | — |
SetAsInternalvoid
public static void SetAsInternal(string name, bool @internal);Defines if the specified setting is considered internal. An internal setting won't show up in the Project Settings dialog. This is mostly useful for addons that need to store their own internal settings without exposing them directly to the user.
| Name | Type | Default |
|---|---|---|
name | string | — |
internal | bool | — |
SetInitialValuevoid
public static void SetInitialValue(string name, Variant value);Sets an existing setting initial value without changing its current value. A value equal to its initial value is omitted when saving. Create a missing key with SetSetting first.
| Name | Type | Default |
|---|---|---|
name | string | — |
value | Variant | — |
nameKey of an existing setting.
valueInitial value used for save comparisons and property reversion; does not assign the current value.
SetOrdervoid
public static void SetOrder(string name, int position);Sets the order of a configuration value (influences when saved to the config file).
| Name | Type | Default |
|---|---|---|
name | string | — |
position | int | — |
SetRestartIfChangedvoid
public static void SetRestartIfChanged(string name, bool restart);Sets whether a setting requires restarting the editor to properly take effect.
Note: This is just a hint to display to the user that the editor must be restarted for changes to take effect. Enabling ProjectSettings.SetRestartIfChanged does not delay the setting being set when changed.
| Name | Type | Default |
|---|---|---|
name | string | — |
restart | bool | — |
SetSettingvoid
public static void SetSetting(string name, Variant value);Sets a setting in memory; Variant Nil removes the key. Does not write a file or guarantee immediate application to a running subsystem. For example, change Engine.MaxFps for the live frame-rate cap.
| Name | Type | Default |
|---|---|---|
name | string | — |
value | Variant | — |
nameFull key of the setting to change or create.
valueNew Variant value. Passing default to this parameter means Nil and removes the key, rather than restoring its initial value.
Signals and events1
SettingsChangedEvent
public static event Action SettingsChanged;Emitted when any setting is changed, up to once per process frame.