How to format asset path name for asset import?

I’m attempting to have all assets within a given folder load automatically. The locations get loaded into a TArray and then I use them in this cast call

Cast<UStaticMesh>(StaticLoadObject(UStaticMesh::StaticClass(), NULL, *output[1]))

*output[1] is just referencing the index in the FString array where the location is stored. The problem I’m running into is that usually when I would call the cast it would read something like this:

Cast<UMaterial>(StaticLoadObject(UMaterial::StaticClass(), NULL, TEXT("StaticMesh'/Game/Environment/Floor/Materials/Water.Water'"

It appears to be expecting “Water.Water” not “Water.uasset” Which is what my function fetches. Is there a simple way to get this instead, or do I need to write something up to chop the extension off and add “.repeatNameOfAsset” ?

We don’t have a function to do that, however you may want to consider using the asset registry instead. That can give you an array of FAssetData entries for a folder, and you can use that to get your hands on the asset pointer. How to get a list of assets from code? - Asset Creation - Epic Developer Community Forums

Please also note that by loading assets in this way, the editor won’t know that it needs to cook them (as nothing is referencing them), so you’ll have to add them to your list of “Additional Asset Directories to Cook” in your project settings.