Download

Problem with IAssetRegistry::GetDependencies

This piece of code should return all dependencies of the selected levels (if any are selected in the content browser) but the TArray<FName> Referencers is empty. AssetRegistry and ContentBrowser are initialized elsewhere and are valid (I use them in other places without error).



	TArray<FAssetData> SelectedAssets;
	ContentBrowser->GetSelectedAssets(SelectedAssets);
	TArray<FName> Referencers;
	if (SelectedAssets.Num() > 0)
	{
		for (FAssetData AssetData : SelectedAssets)
		{
			if (AssetData.AssetClass.IsEqual(*UWorld::StaticClass()->GetName()))
			{
				FName PackageName = AssetData.ObjectPath;
				AssetRegistry->GetReferencers(PackageName, Referencers);
				AssetRegistry->GetDependencies(PackageName, Referencers);
			}
		}
	}