How to find all assets in path?

I’m trying to make tile generator. I have some tiles named like GrassTile01, GrassTile02, GrassTile03…

and in my c++ constructor I found some assets like this

    static ConstructorHelpers::FObjectFinder<UStaticMesh> GrassTile(TEXT("/Game/HighlandTileSet/Grass_01");

    // ...
    // in for loop, loop all tile x, y
    if(GrassTile.Object != NULL)

but I think it’s not a good solution for my goal. because I have so many tiles.

I want to generate random tile map. so I want to find all my static meshes in some path like /Game/HighlandTile/ or /Game/DesertTile

is there some good solution for this? to make static FObjectFinder variables for each static mesh is only way to find assets in c++ code?

AssetRegistry is all you need for your asset needs:

I also don’t recommend you do it in constructor as what is in constructor will done to Class Default Object on engine start up, and i don’t think you want that. Insted set tiles on initiation of actor, like PostInitializeComponents(), which keep in mind will be also executed in editor, if you want for this to happen only in game use BeginPlay()