Array of static meshes

How would I create an array of static meshes to randomly choose between for assigning an object on spawn? Ideal would be that it could be edited within the editor details panel. Trying to add variation to spawned items, they would all derive from the same class and act the same, just would like to randomize the mesh a bit.

Thanks for your help!

.h


public:
UPROPERTY(EditAnywhere) TArray<UStaticMesh*> StaticMeshes;

.cpp, in BeginPlay


Mesh->SetStaticMesh(StaticMeshes[FMath::FRand()*StaticMeshes.Num()];

With Mesh being the UStaticMeshComponent variable that you want to change, assuming you added the static mesh component through c++.

^ May have some syntax errors as I can’t test it, but should be good.