Add a mesh component ue4

Viewed 2819

Third day learning unreal engine. I hardly learned how to spawn an actor using c++, but it spawn with no components (I mean no cube or sphere mesh) so I cant see it. I did add a cube mesh component in the c++ class but it doesn't show in the level. I can add a cube component inside the level but it doesn't appear with the spawn actor. Thanks for replying to this stupid question.

cpp code :

ACreateStaticMesh::ACreateStaticMesh()
{

    PrimaryActorTick.bCanEverTick = true;

    // Add static mesh component to actor
    SuperMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("My Super Mesh"));

}

header file :

UPROPERTY(VisibleAnywhere)
    UStaticMeshComponent* SuperMesh;
0 Answers
Related