diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 00fdcb676bd..47675bcffef 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -58,6 +58,7 @@ void ScriptCreateDialog::config(const String &p_base_name, const String &p_base_ file_path->set_text(""); } _lang_changed(current_language); + _template_changed(template_menu->get_selected()); _parent_name_changed(parent_name->get_text()); _class_name_changed(""); _path_changed(file_path->get_text()); @@ -118,13 +119,15 @@ void ScriptCreateDialog::_parent_name_changed(const String &p_parent) { void ScriptCreateDialog::_template_changed(int p_template) { + String selected_template = p_template == 0 ? "" : template_menu->get_item_text(template_menu->get_selected()); + EditorSettings::get_singleton()->set_project_metadata("script_setup", "last_selected_template", selected_template); if (p_template == 0) { //default script_template = ""; return; } String ext = ScriptServer::get_language(language_menu->get_selected())->get_extension(); - String name = template_menu->get_item_text(p_template) + "." + ext; + String name = template_list[p_template - 1] + "." + ext; script_template = EditorSettings::get_singleton()->get_settings_path() + "/script_templates/" + name; } @@ -148,15 +151,19 @@ void ScriptCreateDialog::_create_new() { Ref