Class EditorSettings
- Namespace
- Godot
- Assembly
- GodotSharpEditor.dll
Object that holds the project-independent editor settings. These settings are generally visible in the Editor > Editor Settings menu.
Property names use slash delimiters to distinguish sections. Setting values can be of any Variant type. It's recommended to use snake_case
for editor settings to be consistent with the Godot editor itself.
Accessing the settings can be done using the following methods, such as:
EditorSettings settings = EditorInterface.Singleton.GetEditorSettings();
// `settings.set("some/property", value)` also works as this class overrides `_set()` internally.
settings.SetSetting("some/property", Value);
// `settings.get("some/property", value)` also works as this class overrides `_get()` internally.
settings.GetSetting("some/property");
Godot.Collections.Array<Godot.Collections.Dictionary> listOfSettings = settings.GetPropertyList();
Note: This class shouldn't be instantiated directly. Instead, access the singleton using GetEditorSettings().
public class EditorSettings : Resource, IDisposable
- Inheritance
-
EditorSettings
- Implements
- Inherited Members
Constructors
EditorSettings()
public EditorSettings()
Fields
NotificationEditorSettingsChanged
Emitted after any editor setting has changed. It's used by various editor plugins to update their visuals on theme changes or logic on configuration changes.
public const long NotificationEditorSettingsChanged = 10000
Field Value
Methods
AddPropertyInfo(Dictionary)
Adds a custom property info to a property. The dictionary must contain:
- name
: string (the name of the property)
- type
: int (see Variant.Type)
- optionally hint
: int (see PropertyHint) and hint_string
: string
Example:
var settings = GetEditorInterface().GetEditorSettings();
settings.Set("category/property_name", 0);
var propertyInfo = new Godot.Collections.Dictionary
{
{"name", "category/propertyName"},
{"type", Variant.Type.Int},
{"hint", PropertyHint.Enum},
{"hint_string", "one,two,three"}
};
settings.AddPropertyInfo(propertyInfo);
public void AddPropertyInfo(Dictionary info)
Parameters
info
Dictionary
CheckChangedSettingsInGroup(string)
Checks if any settings with the prefix settingPrefix
exist in the set of changed settings. See also GetChangedSettings().
public bool CheckChangedSettingsInGroup(string settingPrefix)
Parameters
settingPrefix
string
Returns
Erase(string)
Erases the setting whose name is specified by property
.
public void Erase(string property)
Parameters
property
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 NotificationEditorSettingsChanged.
public string[] GetChangedSettings()
Returns
- string[]
GetFavorites()
Returns the list of favorite files and directories for this project.
public string[] GetFavorites()
Returns
- string[]
GetProjectMetadata(string, string, Variant)
Returns project-specific metadata for the section
and key
specified. If the metadata doesn't exist, default
will be returned instead. See also SetProjectMetadata(string, string, Variant).
public Variant GetProjectMetadata(string section, string key, Variant @default = default)
Parameters
Returns
GetRecentDirs()
Returns the list of recently visited folders in the file dialog for this project.
public string[] GetRecentDirs()
Returns
- string[]
GetSetting(string)
Returns the value of the setting specified by name
. This is equivalent to using Get(StringName) on the EditorSettings instance.
public Variant GetSetting(string name)
Parameters
name
string
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
HasSetting(string)
Returns true
if the setting specified by name
exists, false
otherwise.
public bool HasSetting(string name)
Parameters
name
string
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
MarkSettingChanged(string)
Marks the passed editor setting as being changed, see GetChangedSettings(). Only settings which exist (see HasSetting(string)) will be accepted.
public void MarkSettingChanged(string setting)
Parameters
setting
string
SetBuiltinActionOverride(string, Array<InputEvent>)
Overrides the built-in editor action name
with the input actions defined in actionsList
.
public void SetBuiltinActionOverride(string name, Array<InputEvent> actionsList)
Parameters
name
stringactionsList
Array<InputEvent>
SetFavorites(string[])
Sets the list of favorite files and directories for this project.
public void SetFavorites(string[] dirs)
Parameters
dirs
string[]
SetInitialValue(StringName, Variant, bool)
Sets the initial value of the setting specified by name
to value
. This is used to provide a value for the Revert button in the Editor Settings. If updateCurrent
is true, the current value of the setting will be set to value
as well.
public void SetInitialValue(StringName name, Variant value, bool updateCurrent)
Parameters
name
StringNamevalue
VariantupdateCurrent
bool
SetProjectMetadata(string, string, Variant)
Sets project-specific metadata with the section
, key
and data
specified. This metadata is stored outside the project folder and therefore won't be checked into version control. See also GetProjectMetadata(string, string, Variant).
public void SetProjectMetadata(string section, string key, Variant data)
Parameters
SetRecentDirs(string[])
Sets the list of recently visited folders in the file dialog for this project.
public void SetRecentDirs(string[] dirs)
Parameters
dirs
string[]
SetSetting(string, Variant)
Sets the value
of the setting specified by name
. This is equivalent to using Set(StringName, Variant) on the EditorSettings instance.
public void SetSetting(string name, Variant value)
Parameters
Events
SettingsChanged
Emitted after any editor setting has changed.
public event Action SettingsChanged