Hello, I tried make an array from my chars folder with use ObjectLibrary feature.
void FMyGameEditorModule::GetCharactersInFolder(const FString& Path, TArray<FString>& Paths, TArray<FString>& Names)
{
auto ObjectLibrary = UObjectLibrary::CreateLibrary(ACharacter::StaticClass(), false, true);
ObjectLibrary->LoadAssetDataFromPath(TEXT("/Game/char"));
TArray<FAssetData> AssetDatas;
ObjectLibrary->GetAssetDataList(AssetDatas);
UE_LOG(LogTemp, Warning, TEXT("Found assets: %d"), AssetDatas.Num());
for (const auto& AssetData : AssetDatas)
{
Paths.Add(AssetData.ObjectPath.ToString());
Names.Add(AssetData.AssetName.ToString());
}
}
const FString& Path = "/Game/chars";
TArray<FString> Paths;
TArray<FString> Names;
This code returns 0 every time. I created a character class with cpp in my folder and also created Character BP but nothing return. Could someone give any idea?