I got class “Ship”. it’s a pawn.
i need to set mesh for this pawn in constructor or any function
Hello, SashaqRed
You can do it like this:
//.h
UStaticMeshComponent* ShipMeshComponent;
//.cpp (constructor)
ShipMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Ship Mesh"));
const ConstructorHelpers::FObjectFinder<UStaticMesh> MeshObj(TEXT("StaticMesh'/Game/Meshes/Ship.Ship'"));
ShipMeshComponent->SetStaticMesh(MeshObj.Object);
Please note that you can obtain the reference to your mesh asset by right-clicking on it in the Content Browser and selecting Copy Reference option in the References tab.
Hope this helped!
Good luck!