Asset registry, compilation error on Editor build

Hello,

I’m trying to access AssetRegistry from C++ :

#include "UStanceManager.h"
#include "Engine/AssetManager.h"
#include "AssetRegistry/AssetRegistryModule.h"
#include "AssetRegistry/IAssetRegistry.h"
#include "../Utils/ULogger.h"

void UStanceManager::PlayExAnim()
{
    FAssetRegistryModule registryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(FName("AssetRegistry"));
    IAssetRegistry& registry = registryModule.Get();
}

The compilation works on “Win64 Development Build”, but fails on “Editor Win64 Development Build” or if I run compilation in the Editor, with the error :

   Creating library C:[...]\UnrealEditor-MyProject.sup.exp
UStanceManager.cpp.obj : error LNK2001: Unresolved external symbol "public: virtual void __cdecl FAssetRegistryModule::StartupModule(void)" (?StartupModule@FAssetRegistryModule@@UEAAXXZ) 
C:[...]\UnrealEditor-MyProject.dll : fatal error LNK1120: 1 unresolved external symbol

(I’m on unreal 5.3)

Why there is a difference here ?
How I make this work on Editor build ?

Thank you for your help !

you need to add the module to your “Build.cs”

Thanks for your answer. I search online but I cannot find the name of the module. What is it ?

“AssetRegistry” ^^

Ok, thank very much ^^

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.