Hello,
I have a blueprint function that gets the assets available inside of a folder in my game Game/MusicShoot/Audio/Songs.
//Base Code
//https://answers.unrealengine.com/questions/134539/list-all-maps-in-project-or-directory.html
//
TArray<FString> UMusicalRangeBPFunctionLibrary::GetSongNamesInsideFolder(FString SongPath) {
if (SongPath.IsEmpty())
{
TArray<FString> EmptyArray;
EmptyArray.Add("ERROR");
EmptyArray.Add("Invalid Path");
return EmptyArray;
}
auto ObjectLibrary = UObjectLibrary::CreateLibrary(UObject::StaticClass(), false, true); //UWorld::StaticClass() UObject::StaticClass()
ObjectLibrary->LoadAssetDataFromPath(SongPath); //Path input here "/Game/MusicShoot/Audio/Songs" //Had TEXT() here
TArray<FAssetData> AssetDatas;
ObjectLibrary->GetAssetDataList(AssetDatas);
UE_LOG(LogTemp, Warning, TEXT("Found Songs: %d"), AssetDatas.Num()); //Display ItemsFound
TArray<FString> Names = TArray<FString>();
for (int32 i = 0; i < AssetDatas.Num(); ++i)
{
FAssetData& AssetData = AssetDatas[i];
FString name = AssetData.AssetName.ToString();
if (name.Contains("Track-",ESearchCase::CaseSensitive, ESearchDir::FromStart))
{
name.RemoveFromStart("Track-");
Names.Add(name);
}
}
return Names;
}
The function works perfectly, but I want people to be able to add their own songs to the game, and the game should read and play them. So, after packaging the game, uploading to steam and downloading from steam. I placed another song (uasset file made in ue4, which I removed before packaging) in the steam directory under “common\Game Name\GameName\Content\MusicShoot\Audio\Songs”. But when I launch the game, the new modded song added is not being read by the game.
I tried to enable and disable “Use Pak File”, and it doesn’t do anything. So, how can I have the game Read assets that are not originally packed in?
Related forum post, which may have more info.