I declared the mesh in the header:
//the mesh
UPROPERTY(EditAnywhere,BlueprintReadWrite, Category = "Mesh")
UStaticMeshComponent* mesh;
And create the mesh in the source file:
//create mesh component
mesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("MainMesh"));
RootComponent = mesh;
But when I go back to ue4 editor,create a BP class based on the class above,open the BP editor,I found the staticmesh component like this in the picture:
Anyone can help to work it out?I just want to create a staticmesh component in a c++ class,and dirve a BP class form it,then I can choose mesh and material form the editor.