Unable to apply my custom material to the mesh drawn inside GetDynamicMeshElements after editing FPrimitiveSceneProxy.

Situation: I customized CreateSceneProxy in MYMeshComponent (which inherits from UMeshComponent) to render a mesh from C++. In the proxy class that inherits from FPrimitiveSceneProxy and overrides GetDynamicMeshElements, I use FDynamicMeshBuilder’s GetMesh to draw. I load the material at /Script/Engine.Material’/MyPlugin/Materials/MyMat.MyMat’ using StaticLoadObject and pass that material proxy into GetMesh.

Issue: My custom material MyMat does not show up in the editor. The default MD_Surface material draws correctly with the same code. I confirmed in CreateSceneProxy that the material proxy is loaded and assigned without error.

Checks performed:

– Verified the material’s blend mode is set to opaque rather than translucent

– Confirmed in GetViewRelevance that main-pass and translucency flags are correct

– Added a log just before GetMesh to make sure the material proxy is actually passed in

Figures: Figure 1 shows the attempted MyMat result (nothing visible). Figure 2 shows MD_Surface working as expected. The blue lines in the screenshots are unrelated.

Is there any special step I’m missing to get a custom material to render from within a scene proxy? Any guidance would be greatly appreciated.

Hello,

Thank you for reaching out.

I’ve been assigned this issue, and we will be looking into the missing Material for you.

Can you please send us a minimal test project that demonstrates this, and include screenshots or video of the issue?

The guide for test projects:

[Content removed]

Hello,

Thank you for your reply.

After looking into it, I was able to resolve the issue by calling AddUnique with my custom material in GetUsedMaterials().

If I run into any other problems I can’t solve, I’d appreciate your help again. Thanks in advance!

Hello,

Thank you for sharing your solution.

Can we now close your case? You can always re-open it if you find you need further assistance with the same issue.

Hello,

Of course. Please close this case! Thank you for your help.