diff options
Diffstat (limited to 'scene/2d/mesh_instance_2d.cpp')
-rw-r--r-- | scene/2d/mesh_instance_2d.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/2d/mesh_instance_2d.cpp b/scene/2d/mesh_instance_2d.cpp index a30e1576bf..86b807cbcf 100644 --- a/scene/2d/mesh_instance_2d.cpp +++ b/scene/2d/mesh_instance_2d.cpp @@ -67,6 +67,9 @@ void MeshInstance2D::set_mesh(const Ref<Mesh> &p_mesh) { mesh = p_mesh; if (mesh.is_valid()) { + // If mesh is a PrimitiveMesh, calling get_rid on it can trigger a changed callback + // so do this before connecting to the change signal. + mesh->get_rid(); mesh->connect_changed(callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw)); } |