How to clear material from asset ue4 c++?

Hi Friends,

How does one clear a material from a StaticMeshComponent in UE4 C++?


I know the blueprint equivalent is setting null material which clears any materials


But when I assign “Mesh->SetMaterial(index, NULL)” the editor crashes.
So how are we able to clear a material through UE4 C++?

Thank you for your time!

It worked! Thanks for the info!!!

The signature for UPrimitiveComponent::SetMaterial takes a pointer parameter for the material, not a value. Try providing nullptr instead of NULL and see if that works.