I can use IAssetRegistry like below in my own module:
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
TArray<FAssetData> AssetData;
const UClass* Class = UStaticMesh::StaticClass();
AssetRegistryModule.Get().GetAssetsByClass(Class->GetFName(), AssetData);
but IAssetRegistry does not use ASSETREGISTRY_API to expose its functions to other modules:
UINTERFACE(MinimalApi, BlueprintType, meta = (CannotImplementInterfaceInBlueprint))
class UAssetRegistry : public UInterface
{
GENERATED_UINTERFACE_BODY()
};
class IAssetRegistry
{
GENERATED_IINTERFACE_BODY()
public:
static IAssetRegistry* Get()
{
return UE::AssetRegistry::Private::IAssetRegistrySingleton::Get();
}
static IAssetRegistry& GetChecked()
{
IAssetRegistry* Singleton = UE::AssetRegistry::Private::IAssetRegistrySingleton::Get();
check(Singleton);
return *Singleton;
}
// other functions
}
refer to this slide: UE4 Modules - Google Slides
why can I use functions in IAsserRegistry without adding “AssetRegistry” to my module’s dependency?