diff options
Diffstat (limited to 'editor/editor_settings.cpp')
-rw-r--r-- | editor/editor_settings.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 8634b94858..45c33e093d 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -877,6 +877,13 @@ EditorSettings *EditorSettings::get_singleton() { return singleton.ptr(); } +void EditorSettings::ensure_class_registered() { + ClassDB::APIType prev_api = ClassDB::get_current_api(); + ClassDB::set_current_api(ClassDB::API_EDITOR); + GDREGISTER_CLASS(EditorSettings); // Otherwise it can't be unserialized. + ClassDB::set_current_api(prev_api); +} + void EditorSettings::create() { // IMPORTANT: create() *must* create a valid EditorSettings singleton, // as the rest of the engine code will assume it. As such, it should never @@ -887,7 +894,7 @@ void EditorSettings::create() { return; } - GDREGISTER_CLASS(EditorSettings); // Otherwise it can't be unserialized. + ensure_class_registered(); String config_file_path; Ref<ConfigFile> extra_config = memnew(ConfigFile); |