Struct ProjectSettingsSingleton
Contains global variables accessible from everywhere.
struct ProjectSettingsSingleton
;
Use getSetting
, setSetting
or hasSetting
to access them. Variables stored in project
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.
Overriding: Any project setting can be overridden by creating a file named override
in the project's root directory. This can also be used in exported projects by placing this file in the same directory as the project binary.
Methods
Name | Description |
---|---|
addPropertyInfo
|
Adds a custom property info to a property. The dictionary must contain:
- name : String (the property's name)
- type : long (see Variant )
- optionally hint : long (see propertyhint ) and hint_string : String
Example:
|
clear
|
Clears the whole configuration (not recommended, may break things). |
getOrder
|
Returns the order of a configuration value (influences when saved to the config file). |
getSetting
|
Returns the value of a setting. Example: |
globalizePath
|
Converts a localized path (res:// ) to a full native OS path.
|
hasSetting
|
Returns true if a configuration value is present.
|
loadResourcePack
|
Loads the contents of the .pck or .zip file specified by pack into the resource filesystem (res:// ). Returns true on success.
Note: If a file from pack shares the same path as a file already in the resource filesystem, any attempts to load that file will use the file from pack unless replace_files is set to false .
|
localizePath
|
Convert a path to a localized path (res:// path).
|
propertyCanRevert
|
Returns true if the specified property exists and its initial value differs from the current value.
|
propertyGetRevert
|
Returns the specified property's initial value. Returns null if the property does not exist.
|
save
|
Saves the configuration to the project file.
|
saveCustom
|
Saves the configuration to a custom file. |
setInitialValue
|
Sets the specified property's initial value. This is the value the property reverts to. |
setOrder
|
Sets the order of a configuration value (influences when saved to the config file). |
setSetting
|
Sets the value of a setting. Example: |