diff --git a/core/variant.cpp b/core/variant.cpp index e7d0e583677..16bbf94c549 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -910,7 +910,15 @@ bool Variant::is_one() const { void Variant::reference(const Variant &p_variant) { - clear(); + switch (type) { + case NIL: + case BOOL: + case INT: + case REAL: + break; + default: + clear(); + } type = p_variant.type;