# How can I get my DynamicMeshActor to update the displayed mesh after updating the FDynamicMesh3 component ?

**URL:** <https://forums.unrealengine.com/t/how-can-i-get-my-dynamicmeshactor-to-update-the-displayed-mesh-after-updating-the-fdynamicmesh3-component/2246652>\
**Category:** C++\
**Tags:** unreal-engine, question\
**Created:** [December 28, 2024, 2:27am UTC](https://forums.unrealengine.com/t/how-can-i-get-my-dynamicmeshactor-to-update-the-displayed-mesh-after-updating-the-fdynamicmesh3-component/2246652 "2024-12-28T02:27:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![c.iseli](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@c.iseli](https://forums.unrealengine.com/u/c.iseli)\
**Post date:** [December 28, 2024, 2:27am UTC](https://forums.unrealengine.com/t/how-can-i-get-my-dynamicmeshactor-to-update-the-displayed-mesh-after-updating-the-fdynamicmesh3-component/2246652/1 "2024-12-28T02:27:53Z")

</div>

Hello,

I am using UE version 5.5. I followed the tutorial from gradientspace here [https://www.gradientspace.com/tutorials/2020/10/23/runtime-mesh-generation-in-ue426](https://www.gradientspace.com/tutorials/2020/10/23/runtime-mesh-generation-in-ue426) and created a simple Actor derived from ADynamicMeshActor.

I think I managed to create a proper FDynamicMesh3 object, using spheres with coordinates obtained from a PDB entry from the PDB database site [https://www.rcsb.org/](https://www.rcsb.org/)

According to the log produced by my Actor, the mesh seems properly constructed, but it never gets updated in the view from the Editor (nor when I try to run the code in Game mode).

I have created a test project on GitHub here : [https://github.com/c4chris/PMPDBV](https://github.com/c4chris/PMPDBV)

The function that tries to get the mesh updated for the Actor is in the file `Source/PMPDBV/Private/GrabableDynamicMeshActor.cpp` and reads :

```auto
void AGrabableDynamicMeshActor::UpdateMesh(UE::Geometry::FDynamicMesh3& mesh) {
        mesh.EnableAttributes();
        UE::Geometry::FMeshNormals::InitializeOverlayToPerVertexNormals(mesh.Attributes()->PrimaryNormals(), false);
        SourceMesh = mesh;
        auto dmc = GetDynamicMeshComponent();

        if (dmc) {
                *(dmc->GetMesh()) = SourceMesh;
                dmc->NotifyMeshUpdated();
                // update material on new section
                UMaterialInterface* UseMaterial = (dmc->GetMaterial(0) != nullptr) ? dmc->GetMaterial(0) : UMaterial::GetDefaultMaterial(MD_Surface);
                dmc->SetMaterial(0, UseMaterial);
                UE_LOG(LogPMPDBV, Log, TEXT("AGrabableDynamicMeshActor UpdateMesh succeeded"));
        } else {
                UE_LOG(LogPMPDBV, Warning, TEXT("AGrabableDynamicMeshActor UpdateMesh No Dynamic Mesh Component"));
        }
}

```

The initial dynamic mesh I create with 3 small spheres of 3 different colors is displayed correctly, but the subsequent spheres added from the PDB entry never show up in the display, and I cannot figure out why

I would be very grateful for any hints of things to try

Kind regards,  
Christian
