Clone TObjectPtr<UStaticMesh> StaticMesh;

Hi!

I’m using Unreal 5.4.2.

I have this property which I set it in child Blueprint class:

UPROPERTY(EditDefaultsOnly)
TObjectPtr<UStaticMesh> StaticMesh;

If I want to clone or copy this object, how can I do it?

If I don’t do it, and I change something in the static mesh, like its material instance, I see that change in all of the actors which have this static mesh.

Thanks!

Is there some reason that you want to do that from C++? Normally you’d duplicate the mesh in the Editor, make your changes and assign that one to the property instead.

Alternatively you could construct your mesh in a way that allows for applying dynamic materials to it, but then you’d be assigning the mesh and the material on your object.