From d0fa4ba19492b2d8843e5b6ccb30cc2db3586351 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 8 Feb 2025 14:22:03 +0100 Subject: [PATCH] Clear the material cache data in TerrainChunk::_exit_tree(). --- modules/terraman/world/terrain_chunk.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/terraman/world/terrain_chunk.cpp b/modules/terraman/world/terrain_chunk.cpp index 76a73a49c..2d203d7ef 100644 --- a/modules/terraman/world/terrain_chunk.cpp +++ b/modules/terraman/world/terrain_chunk.cpp @@ -1250,6 +1250,9 @@ void TerrainChunk::_exit_tree() { if (_library.is_valid() && _library->supports_caching()) { if (material_cache_key_has()) { _library->material_cache_unref(material_cache_key_get()); + + material_cache_key_set(0); + material_cache_key_has_set(false); } } }