From fb8623dd968d215386faf0e51edbf570ea85ff3f Mon Sep 17 00:00:00 2001
From: Saracen <SaracenOne@gmail.com>
Date: Tue, 16 Feb 2021 16:45:53 +0000
Subject: [PATCH] Clear existing lightmap data when assigning new data

---
 scene/3d/baked_lightmap.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp
index bc8836d59bd2..1a402cb83f4b 100644
--- a/scene/3d/baked_lightmap.cpp
+++ b/scene/3d/baked_lightmap.cpp
@@ -157,6 +157,8 @@ void BakedLightmapData::clear_data() {
 
 void BakedLightmapData::_set_user_data(const Array &p_data) {
 
+	clear_data();
+
 	// Detect old lightmapper format
 	if (p_data.size() % 3 == 0) {
 		bool is_old_format = true;