diff options
author | Yuri Rubinsky <chaosus89@gmail.com> | 2022-05-26 09:12:20 +0300 |
---|---|---|
committer | Yuri Rubinsky <chaosus89@gmail.com> | 2022-05-26 09:42:59 +0300 |
commit | 8f57d9519eeedac17cae362afdb00bc766069a89 (patch) | |
tree | 49b6105fbfe2736eae599ff1063582bfe4c12eff /scene/3d/visual_instance_3d.cpp | |
parent | 08e540a2ac8067013983ba06b612ac2a29f25dd3 (diff) | |
download | redot-engine-8f57d9519eeedac17cae362afdb00bc766069a89.tar.gz |
Fix errors when materials attached to 3d object are not freed
Diffstat (limited to 'scene/3d/visual_instance_3d.cpp')
-rw-r--r-- | scene/3d/visual_instance_3d.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/scene/3d/visual_instance_3d.cpp b/scene/3d/visual_instance_3d.cpp index 273e01989a..e40c8bfa2b 100644 --- a/scene/3d/visual_instance_3d.cpp +++ b/scene/3d/visual_instance_3d.cpp @@ -496,3 +496,12 @@ void GeometryInstance3D::_bind_methods() { GeometryInstance3D::GeometryInstance3D() { //RS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0); } + +GeometryInstance3D::~GeometryInstance3D() { + if (material_overlay.is_valid()) { + set_material_overlay(Ref<Material>()); + } + if (material_override.is_valid()) { + set_material_override(Ref<Material>()); + } +} |