Fix dangling material RID error
This commit is contained in:
parent
3596c13475
commit
efc12ffefb
@ -233,6 +233,13 @@ DebugMultiMeshRenderer::DebugMultiMeshRenderer() {
|
||||
_multimesh_instance.set_material_override(_material);
|
||||
}
|
||||
|
||||
DebugMultiMeshRenderer::~DebugMultiMeshRenderer() {
|
||||
// A MultiMeshInstance created without nodes does not hold ownership on its material.
|
||||
// So we need to destroy it before we release ownership at the end of this destructor.
|
||||
// Otherwise RenderingServer produces errors.
|
||||
_multimesh_instance.destroy();
|
||||
}
|
||||
|
||||
void DebugMultiMeshRenderer::set_world(World3D *world) {
|
||||
_multimesh_instance.set_world(world);
|
||||
_world = world;
|
||||
|
@ -11,7 +11,7 @@ class World3D;
|
||||
|
||||
namespace VoxelDebug {
|
||||
|
||||
enum ColorID {
|
||||
enum ColorID { //
|
||||
ID_VOXEL_BOUNDS = 0,
|
||||
ID_OCTREE_BOUNDS,
|
||||
ID_VOXEL_GRAPH_DEBUG_BOUNDS,
|
||||
@ -25,6 +25,7 @@ void free_resources();
|
||||
class DebugMultiMeshRenderer {
|
||||
public:
|
||||
DebugMultiMeshRenderer();
|
||||
~DebugMultiMeshRenderer();
|
||||
|
||||
void set_world(World3D *world);
|
||||
void begin();
|
||||
|
Loading…
x
Reference in New Issue
Block a user