reckfellENGINE

ProjectSettings

Stores globally-accessible variables.

On this page
class ProjectSettingsReckfellSharp

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
# Singleton
C#
public static ProjectSettingsInstance Singleton { get; }

Methods22

AddPropertyInfovoid
# AddPropertyInfo
C#
public static void AddPropertyInfo(Reckfell.Collections.Dictionary hint);

Adds a custom property info to a property. The dictionary must contain:

  • "name": string (the property's name)
  • "type": [int] (see Variant.Type)
  • optionally "hint": string
C#
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.

Parameters
NameTypeDefault
hintReckfell.Collections.Dictionary—
CheckChangedSettingsInGroupbool
# CheckChangedSettingsInGroup
C#
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.

Parameters
NameTypeDefault
settingPrefixstring—
Returns bool
Clearvoid
# Clear
C#
public static void Clear(string name);

Clears the whole configuration (not recommended, may break things).

Parameters
NameTypeDefault
namestring—
GetChangedSettingsstring[]
# GetChangedSettings
C#
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.

Returns string[]
GetGlobalClassListReckfell.Collections.Array<Reckfell.Collections.Dictionary>
# GetGlobalClassList
C#
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:

  • base is a name of the base class;
  • class is a name of the registered global class;
  • icon is a path to a custom icon of the global class, if it has any;
  • language is a name of a programming language in which the global class is written;
  • path is 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 with asset://.
Returns Reckfell.Collections.Array<Reckfell.Collections.Dictionary>
GetOrderint
# GetOrder
C#
public static int GetOrder(string name);

Returns the order of a configuration value (influences when saved to the config file).

Parameters
NameTypeDefault
namestring—
Returns int
GetSettingVariant
# GetSetting
C#
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.

Parameters
NameTypeDefault
namestring—
defaultValueVariantdefault
name

Full setting key, such as application/run/max_fps.

defaultValue

Value returned for a missing key; does not replace an existing value of the wrong type.

Returns Variant

The stored value or defaultValue as a Variant. Check VariantType before conversion when the data type is not guaranteed.

GetSettingWithOverrideVariant
# GetSettingWithOverride
C#
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.

Parameters
NameTypeDefault
nameStringName—
name

Base setting name without a feature suffix, such as game/content_mode. Define the base setting before reading it.

Returns Variant

The active override or base value as a Variant; convert to the expected type, for example AsString() for a string.

GetSettingWithOverrideAndCustomFeatures2 overloads
# GetSettingWithOverrideAndCustomFeatures · 1/2
C#
public static Variant GetSettingWithOverrideAndCustomFeatures(StringName name, ReadOnlySpan<string> features);

Similar to ProjectSettings.GetSettingWithOverride, but applies feature tag overrides instead of current OS features.

Parameters
NameTypeDefault
nameStringName—
featuresReadOnlySpan<string>—
Returns Variant
# GetSettingWithOverrideAndCustomFeatures · 2/2
C#
public static Variant GetSettingWithOverrideAndCustomFeatures(StringName name, string[] features);

Similar to ProjectSettings.GetSettingWithOverride, but applies feature tag overrides instead of current OS features.

Parameters
NameTypeDefault
nameStringName—
featuresstring[]—
Returns Variant
GlobalizePathstring
# GlobalizePath
C#
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.

Parameters
NameTypeDefault
pathstring—
Returns string
HasSettingbool
# HasSetting
C#
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.

Parameters
NameTypeDefault
namestring—
name

Full setting key, such as game/starting_lives.

Returns bool

true for an existing key; false for a missing key or one removed with Variant Nil.

LoadResourcePackbool
# LoadResourcePack
C#
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.

Parameters
NameTypeDefault
packstring—
replaceFilesbooltrue
offsetint0
pack

Pack 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.

replaceFiles

Defaults 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.

offset

PCK starting offset in bytes; normally 0. Not supported for ZIP. Not an individual resource offset within the pack.

Returns bool

true if the pack is recognized and mounted; false on failure. Does not return an Error or test loading every resource in the pack.

LocalizePathstring
# LocalizePath
C#
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.

Parameters
NameTypeDefault
pathstring—
Returns string
SaveError
# Save
C#
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.

Returns Error
SaveCustomError
# SaveCustom
C#
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://.

Parameters
NameTypeDefault
filestring—
file

Path ending in .reckfell or override.cfg for text, or .binary for binary output. An arbitrary .json file is unsupported; the directory must be writable.

Returns Error

Error.Ok on successful writing; otherwise an error code. Check it before reporting that saving succeeded.

SetAsBasicvoid
# SetAsBasic
C#
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.

Parameters
NameTypeDefault
namestring—
basicbool—
SetAsInternalvoid
# SetAsInternal
C#
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.

Parameters
NameTypeDefault
namestring—
internalbool—
SetInitialValuevoid
# SetInitialValue
C#
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.

Parameters
NameTypeDefault
namestring—
valueVariant—
name

Key of an existing setting.

value

Initial value used for save comparisons and property reversion; does not assign the current value.

SetOrdervoid
# SetOrder
C#
public static void SetOrder(string name, int position);

Sets the order of a configuration value (influences when saved to the config file).

Parameters
NameTypeDefault
namestring—
positionint—
SetRestartIfChangedvoid
# SetRestartIfChanged
C#
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.

Parameters
NameTypeDefault
namestring—
restartbool—
SetSettingvoid
# SetSetting
C#
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.

Parameters
NameTypeDefault
namestring—
valueVariant—
name

Full key of the setting to change or create.

value

New Variant value. Passing default to this parameter means Nil and removes the key, rather than restoring its initial value.

Signals and events1

SettingsChangedEvent
# SettingsChanged
C#
public static event Action SettingsChanged;

Emitted when any setting is changed, up to once per process frame.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.