summaryrefslogtreecommitdiff
path: root/editor/editor_data.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_data.cpp')
-rw-r--r--editor/editor_data.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 48be0c9c00..f15b874c45 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -945,11 +945,11 @@ StringName EditorData::script_class_get_base(const String &p_class) const {
Variant EditorData::script_class_instance(const String &p_class) {
if (ScriptServer::is_global_class(p_class)) {
- Variant obj = ClassDB::instantiate(ScriptServer::get_global_class_native_base(p_class));
- if (obj) {
- Ref<Script> script = script_class_load_script(p_class);
- if (script.is_valid()) {
- ((Object *)obj)->set_script(script);
+ Ref<Script> script = script_class_load_script(p_class);
+ if (script.is_valid()) {
+ Object *obj = ClassDB::instantiate(script->get_instance_base_type());
+ if (obj) {
+ obj->set_script(script);
}
return obj;
}