diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp index 9b9f0455a13..22ff0611a74 100644 --- a/scene/debugger/scene_debugger.cpp +++ b/scene/debugger/scene_debugger.cpp @@ -347,13 +347,17 @@ void SceneDebuggerObject::serialize(Array &r_arr, int p_max_size) { const PropertyInfo &pi = properties[i].first; Variant &var = properties[i].second; - WeakRef *ref = Object::cast_to(var); - if (ref) { - var = ref->get_ref(); - } - RES res = var; + if (var.get_type() == Variant::OBJECT && var.is_ref()) { + REF r = var; + if (r.is_valid()) { + res = *r; + } else { + res = RES(); + } + } + Array prop; prop.push_back(pi.name); prop.push_back(pi.type);