Browse Source

Check if import_script is subtype of EditorScenePostImport

Raphaël Daubelcour 4 months ago
parent
commit
9511e1137d
1 changed files with 2 additions and 0 deletions
  1. 2 0
      editor/import/3d/resource_importer_scene.cpp

+ 2 - 0
editor/import/3d/resource_importer_scene.cpp

@@ -3205,6 +3205,8 @@ Error ResourceImporterScene::import(ResourceUID::ID p_source_id, const String &p
 		Ref<Script> scr = ResourceLoader::load(post_import_script_path);
 		if (scr.is_null()) {
 			EditorNode::add_io_error(TTR("Couldn't load post-import script:") + " " + post_import_script_path);
+		} else if (scr->get_instance_base_type() != "EditorScenePostImport") {
+			EditorNode::add_io_error(TTR("Script is not a subtype of EditorScenePostImport:") + " " + post_import_script_path);
 		} else {
 			post_import_script.instantiate();
 			post_import_script->set_script(scr);