StaticLoadObject from an external file

I have a .OBJ file stored locally (let’s say in C:\mesh.obj) and I need to be able to open it when I run the game (I pass the absolute path as a command line parameter).

Here is what I tried:

PrimaryActorTick.bCanEverTick = true;
FString Str = "file://C:/mesh.obj";    // also tried: "C:/mesh.obj"
UStaticMesh * m = Cast<UStaticMesh>(StaticLoadObject(UStaticMesh::StaticClass(), NULL, *Str));
VisualComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualComponent"));
RootComponent = VisualComponent;

this just does nothing, I cannot see the model neither in the editor, nor in the game.

If instead I try

FString Str = "file://C:/mesh.obj";    // also tried: "C:/mesh.obj"
const ConstructorHelpers::FObjectFinder<UStaticMesh> MeshObj(*Str);

the compilation fails with the error “Failed to find file://C:/mesh.obj”.

Have you figured out the problem? I am facing the same issure.

Well, partially. I switched to a CAD-based format for the 3d data and use a 3d party lib (ifcEngine dll) for triangulation. Then I create proceduralMeshComponents using the triangles yielded by the library.