Contains global variables accessible from everywhere.
    public static class ProjectSettings

Contains global variables accessible from everywhere. Use “ProjectSettings.get_setting(variable)”, “ProjectSettings.set_setting(variable,value)” or “ProjectSettings.has_setting(variable)” to access them. Variables stored in project.godot are also loaded into ProjectSettings, making this object very useful for reading custom game configuration options.

Inheritance Chain

Static Properties

    public static Object Singleton { get; }

Static Methods

    public static void AddPropertyInfo(Dictionary hint)

Add a custom property info to a property. The dictionary must contain: name:String(the name of the property) and type:[int](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/int](see TYPE_* in [@GlobalScope]), and optionally hint:[int](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/int](see PROPERTY_HINT_* in [@GlobalScope]), hint_string:String.

Example:

[codeblock]

ProjectSettings.set(“category/property_name”, 0)

var property_info = {

“name”: “category/property_name”,

“type”: TYPE_INT,

“hint”: PROPERTY_HINT_ENUM,

“hint_string”: “one,two,three”

}

ProjectSettings.add_property_info(property_info)

[/codeblock]

    public static void Clear(string name)

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

    public static int GetOrder(string name)

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

    public static object GetSetting(string name)

    public static string GlobalizePath(string path)

Convert a localized path (res://) to a full native OS path.

    public static bool HasSetting(string name)

Return true if a configuration value is present.

    public static bool LoadResourcePack(string pack)

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.

    public static string LocalizePath(string path)

Convert a path to a localized path (res:// path).

    public static bool PropertyCanRevert(string name)

Returns true if the specified property exists and its initial value differs from the current value.

    public static object PropertyGetRevert(string name)

Returns the initial value of the specified property. Returns null if the property does not exist.

    public static Error Save()

Saves the configuration to the project.godot file.

    public static Error SaveCustom(string file)

Saves the configuration to a custom file.

    public static void SetInitialValue(string name, object value)

    public static void SetOrder(string name, int position)

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

    public static void SetSetting(string name, object value)
Tags: