Hi,
I’m trying to write this blueprint that i made, in C++ but i’m having some troubles finding the blueprint version of this nodes in C++.
2 Likes
I think this is what you’re looking for.
UStaticMeshComponent* MeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("<name>"));
MeshComponent->SetStaticMesh(<your mesh as UStaticMesh*>);
1 Like
^ Create and set static mesh.
v Attach static mesh to actor.
MeshComponent->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
3 Likes
MeshComponent->SetupAttachment();
is the preferred way to attach components in constructors btw.
3 Likes
How do I retrieve the mesh information from one of my meshes to enter into the SetStaticMesh function?