UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FModuleManager Class Reference

#include <ModuleManager.h>

+ Inheritance diagram for FModuleManager:

Public Types

using instead = TTSMulticastDelegate< void(FName ModuleName, EModuleChangeReason ChangeReason)>
 
using instead = TMulticastDelegate< void(FName, bool)>
 

Public Member Functions

CORE_API ~FModuleManager ()
 
CORE_API void AbandonModule (const FName InModuleName)
 
CORE_API void AddModule (const FName InModuleName)
 
CORE_API void RefreshModuleFilenameFromManifest (const FName InModuleName)
 
CORE_API IModuleInterfaceGetModule (const FName InModuleName)
 
CORE_API bool IsModuleSafeToUse (const FName InModuleName) const
 
CORE_API bool IsModuleLoaded (const FName InModuleName) const
 
CORE_API IModuleInterfaceLoadModule (const FName InModuleName, ELoadModuleFlags InLoadModuleFlags=ELoadModuleFlags::None)
 
CORE_API IModuleInterfaceLoadModuleChecked (const FName InModuleName)
 
CORE_API bool LoadModuleWithCallback (const FName InModuleName, FOutputDevice &Ar)
 
CORE_API IModuleInterfaceLoadModuleWithFailureReason (const FName InModuleName, EModuleLoadResult &OutFailureReason, ELoadModuleFlags InLoadModuleFlags=ELoadModuleFlags::None)
 
CORE_API bool QueryModule (const FName InModuleName, FModuleStatus &OutModuleStatus) const
 
CORE_API void QueryModules (TArray< FModuleStatus > &OutModuleStatuses) const
 
CORE_API bool UnloadModule (const FName InModuleName, bool bIsShutdown=false, bool bAllowUnloadCode=true)
 
CORE_API void UnloadOrAbandonModuleWithCallback (const FName InModuleName, FOutputDevice &Ar)
 
CORE_API void AbandonModuleWithCallback (const FName InModuleName)
 
CORE_API void AddExtraBinarySearchPaths ()
 
CORE_API void FindModules (const TCHAR *WildcardWithoutExtension, TArray< FName > &OutModules) const
 
CORE_API void FindModules (const TCHAR *WildcardWithoutExtension, TArray< FModuleDiskInfo > &OutModules) const
 
CORE_API bool ModuleExists (const TCHAR *ModuleName, FString *OutModuleFilePath=nullptr) const
 
CORE_API int32 GetModuleCount () const
 
CORE_API void UnloadModulesAtShutdown ()
 
 DECLARE_DELEGATE_RetVal (IModuleInterface *, FInitializeStaticallyLinkedModule) typedef IModuleInterface *FInitializeStaticallyLinkedModuleRaw()
 
CORE_API void StartProcessingNewlyLoadedObjects ()
 
CORE_API void AddBinariesDirectory (const TCHAR *InDirectory, bool bIsGameDirectory)
 
CORE_API void LoadModuleBinaryOnly (FName ModuleName)
 
CORE_API void SetGameBinariesDirectory (const TCHAR *InDirectory)
 
CORE_API FString GetGameBinariesDirectory () const
 
CORE_API bool IsModuleUpToDate (const FName InModuleName) const
 
CORE_API bool DoesLoadedModuleHaveUObjects (const FName ModuleName) const
 
CORE_API FString GetModuleFilename (FName ModuleName) const
 
CORE_API void SetModuleFilename (FName ModuleName, const FString &Filename)
 
CORE_API bool HasAnyOverridenModuleFilename () const
 
CORE_API void SaveCurrentStateForBootstrap (const TCHAR *Filename)
 
TTSMulticastDelegateRegistration< void(FName ModuleName, EModuleChangeReason ChangeReason)> & OnModulesChanged ()
 
TMulticastDelegateRegistration< void(FName, bool)> & OnProcessLoadedObjectsCallback ()
 
TMulticastDelegateRegistration< void(TConstArrayView< FName >)> & OnModulesUnloaded ()
 
TDelegateRegistration< bool(TConstArrayView< FName >)> & OnCheckLiveObjectsInModulesCallback ()
 
 DECLARE_DELEGATE_RetVal_OneParam (bool, FIsPackageLoadedCallback, FName)
 
FIsPackageLoadedCallbackIsPackageLoadedCallback ()
 
CORE_API FModuleManager (FPrivateToken)
 
 FModuleManager (const FModuleManager &)=delete
 
FModuleManageroperator= (const FModuleManager &)=delete
 
CORE_API void MakeUniqueModuleFilename (const FName InModuleName, FString &UniqueSuffix, FString &UniqueModuleFileName) const
 
CORE_API void AddModuleToModulesList (const FName InModuleName, FModuleManager::ModuleInfoRef &ModuleInfo)
 
CORE_API void ResetModulePathsCache ()
 
CORE_API void OnObjectCleanup ()
 

Static Public Member Functions

static CORE_API FModuleManagerGet ()
 
static CORE_API void TearDown ()
 
template<typename TModuleInterface >
static TModuleInterfaceGetModuleChecked (const FName ModuleName)
 
template<typename TModuleInterface >
static UE_FORCEINLINE_HINT TModuleInterfaceGetModulePtr (const FName ModuleName)
 
template<typename TModuleInterface >
static TModuleInterfaceLoadModuleChecked (const FName InModuleName)
 
template<typename TModuleInterface >
static TModuleInterfaceLoadModulePtr (const FName InModuleName)
 
static CORE_API void RegisterStaticallyLinkedModule (const FLazyName InModuleName, FInitializeStaticallyLinkedModuleRaw *InInitializer)
 
static CORE_API const TCHARGetUBTConfiguration ()
 

Protected Member Functions

virtual CORE_API bool Exec_Dev (UWorld *Inworld, const TCHAR *Cmd, FOutputDevice &Ar) override
 

Friends

TOptional< FModuleManager > & UE::Core::Private::GetModuleManagerSingleton ()
 
FArchiveoperator<< (FArchive &Ar, FModuleManager &ModuleManager)
 

Detailed Description

Implements the module manager.

The module manager is used to load and unload modules, as well as to keep track of all of the modules that are currently loaded. You can access this singleton using FModuleManager::Get().

Member Typedef Documentation

◆ instead [1/2]

◆ instead [2/2]

Constructor & Destructor Documentation

◆ ~FModuleManager()

FModuleManager::~FModuleManager ( )

Destructor.

◆ FModuleManager() [1/2]

FModuleManager::FModuleManager ( FPrivateToken  )

Hidden constructor.

Use the static Get function to return the singleton instance.

◆ FModuleManager() [2/2]

FModuleManager::FModuleManager ( const FModuleManager )
delete

Member Function Documentation

◆ AbandonModule()

void FModuleManager::AbandonModule ( const FName  InModuleName)

Abandons a loaded module, leaving it loaded in memory but no longer tracking it in the module manager.

Parameters
InModuleNameThe name of the module to abandon. Should not include path, extension or platform/configuration info. This is just the "module name" part of the module file name.
See also
IsModuleLoaded, LoadModule, LoadModuleWithFailureReason, UnloadModule

◆ AbandonModuleWithCallback()

void FModuleManager::AbandonModuleWithCallback ( const FName  InModuleName)

Calls PreUnload then abandons a module in memory.

Parameters
InModuleNameThe name of the module to unload.
See also
LoadModuleWithCallback

◆ AddBinariesDirectory()

void FModuleManager::AddBinariesDirectory ( const TCHAR InDirectory,
bool  bIsGameDirectory 
)

Adds an engine binaries directory.

◆ AddExtraBinarySearchPaths()

void FModuleManager::AddExtraBinarySearchPaths ( )

Add any extra search paths that may be required

◆ AddModule()

void FModuleManager::AddModule ( const FName  InModuleName)

Adds a module to our list of modules, unless it's already known.

Parameters
InModuleNameThe base name of the module file. Should not include path, extension or platform/configuration info. This is just the "name" part of the module file name. Names should be globally unique.

◆ AddModuleToModulesList()

void FModuleManager::AddModuleToModulesList ( const FName  InModuleName,
FModuleManager::ModuleInfoRef ModuleInfo 
)

◆ DECLARE_DELEGATE_RetVal()

FModuleManager::DECLARE_DELEGATE_RetVal ( IModuleInterface ,
FInitializeStaticallyLinkedModule   
)

Delegate that's used by the module manager to initialize a registered module that we statically linked with (monolithic only) Raw function type used during module registration.

◆ DECLARE_DELEGATE_RetVal_OneParam()

FModuleManager::DECLARE_DELEGATE_RetVal_OneParam ( bool  ,
FIsPackageLoadedCallback  ,
FName   
)

Gets a delegate that is executed when a module containing UObjects has been loaded.

The first parameter is the name of the loaded module.

Returns
The event delegate.

◆ DoesLoadedModuleHaveUObjects()

bool FModuleManager::DoesLoadedModuleHaveUObjects ( const FName  ModuleName) const

Determines whether the specified module contains UObjects. The module must already be loaded into memory before calling this function.

Parameters
ModuleNameName of the loaded module to check.
Returns
True if the module was found to contain UObjects, or false if it did not (or wasn't loaded.)

◆ Exec_Dev()

bool FModuleManager::Exec_Dev ( UWorld InWorld,
const TCHAR Cmd,
FOutputDevice Ar 
)
overrideprotectedvirtual

Implementation of Exec that is only called in non-shipping targets

Reimplemented from FExec.

◆ FindModules() [1/2]

void FModuleManager::FindModules ( const TCHAR WildcardWithoutExtension,
TArray< FModuleDiskInfo > &  OutModules 
) const

◆ FindModules() [2/2]

void FModuleManager::FindModules ( const TCHAR WildcardWithoutExtension,
TArray< FName > &  OutModules 
) const

Finds module files on the disk for loadable modules matching the specified wildcard.

Parameters
WildcardWithoutExtensionFilename part (no path, no extension, no build config info) to search for.
OutModulesList of modules found.

◆ Get()

FModuleManager & FModuleManager::Get ( )
static

Gets the singleton instance of the module manager.

Returns
The module manager instance.

◆ GetGameBinariesDirectory()

FString FModuleManager::GetGameBinariesDirectory ( ) const

Gets the game binaries directory

◆ GetModule()

IModuleInterface * FModuleManager::GetModule ( const FName  InModuleName)

Gets the specified module.

Parameters
InModuleNameName of the module to return.
Returns
The module, or nullptr if the module is not loaded.
See also
GetModuleChecked, GetModulePtr

◆ GetModuleChecked()

static TModuleInterface & FModuleManager::GetModuleChecked ( const FName  ModuleName)
inlinestatic

Gets a module by name, checking to ensure it exists.

This method checks whether the module actually exists. If the module does not exist, an assertion will be triggered.

Parameters
ModuleNameThe module to get.
Returns
The interface to the module.
See also
GetModulePtr, LoadModulePtr, LoadModuleChecked

◆ GetModuleCount()

int32 FModuleManager::GetModuleCount ( ) const

Gets the number of loaded modules.

Returns
The number of modules.

◆ GetModuleFilename()

FString FModuleManager::GetModuleFilename ( FName  ModuleName) const

Gets the filename for a module. The return value is a full path of a module known to the module manager.

◆ GetModulePtr()

static UE_FORCEINLINE_HINT TModuleInterface * FModuleManager::GetModulePtr ( const FName  ModuleName)
inlinestatic

Gets a module by name.

Parameters
ModuleNameThe module to get.
Returns
The interface to the module, or nullptr if the module was not found.
See also
GetModuleChecked, LoadModulePtr, LoadModuleChecked

◆ GetUBTConfiguration()

const TCHAR * FModuleManager::GetUBTConfiguration ( )
static

Gets the build configuration for compiling modules, as required by UBT.

Returns
Configuration name for UBT.

◆ HasAnyOverridenModuleFilename()

bool FModuleManager::HasAnyOverridenModuleFilename ( ) const

Determines if any non-default module instances are loaded (eg. hot reloaded modules)

◆ IsModuleLoaded()

bool FModuleManager::IsModuleLoaded ( const FName  InModuleName) const

Checks whether the specified module is currently loaded.

This is an O(1) operation.

Parameters
InModuleNameThe base name of the module file. Should not include path, extension or platform/configuration info. This is just the "module name" part of the module file name. Names should be globally unique.
Returns
true if module is currently loaded, false otherwise.
See also
AbandonModule, LoadModule, LoadModuleWithFailureReason, UnloadModule

◆ IsModuleSafeToUse()

bool FModuleManager::IsModuleSafeToUse ( const FName  InModuleName) const

Checks whether a module is compiled-in, or currently loaded, with all code inside safe to call.

Parameters
InModuleNameName of the module to check.
Returns
true for a module that exists and is not compiled into the executable.

◆ IsModuleUpToDate()

bool FModuleManager::IsModuleUpToDate ( const FName  InModuleName) const

Checks to see if the specified module exists and is compatible with the current engine version.

Parameters
InModuleNameThe base name of the module file.
Returns
true if module exists and is up to date, false otherwise.

◆ IsPackageLoadedCallback()

FIsPackageLoadedCallback & FModuleManager::IsPackageLoadedCallback ( )
inline

◆ LoadModule()

IModuleInterface * FModuleManager::LoadModule ( const FName  InModuleName,
ELoadModuleFlags  InLoadModuleFlags = ELoadModuleFlags::None 
)

Loads the specified module.

Parameters
InModuleNameThe base name of the module file. Should not include path, extension or platform/configuration info. This is just the "module name" part of the module file name. Names should be globally unique.
InLoadModuleFlagsOptional flags for module load operation.
Returns
The loaded module, or nullptr if the load operation failed.
See also
AbandonModule, IsModuleLoaded, LoadModuleChecked, LoadModulePtr, LoadModuleWithFailureReason, UnloadModule

◆ LoadModuleBinaryOnly()

void FModuleManager::LoadModuleBinaryOnly ( FName  ModuleName)

Will load the binary without doing initialization. Calling this will not make it possible to unload the module again

◆ LoadModuleChecked() [1/2]

IModuleInterface & FModuleManager::LoadModuleChecked ( const FName  InModuleName)

Loads the specified module, checking to ensure it exists.

Parameters
InModuleNameThe base name of the module file. Should not include path, extension or platform/configuration info. This is just the "module name" part of the module file name. Names should be globally unique.
Returns
The loaded module, or nullptr if the load operation failed.
See also
AbandonModule, IsModuleLoaded, LoadModuleChecked, LoadModulePtr, LoadModuleWithFailureReason, UnloadModule

◆ LoadModuleChecked() [2/2]

static TModuleInterface & FModuleManager::LoadModuleChecked ( const FName  InModuleName)
inlinestatic

Loads a module by name, checking to ensure it exists.

This method checks whether the module actually exists. If the module does not exist, an assertion will be triggered. If the module was already loaded previously, the existing instance will be returned.

Parameters
ModuleNameThe module to find and load
Returns
Returns the module interface, casted to the specified typename
See also
GetModulePtr, LoadModulePtr, LoadModuleChecked

◆ LoadModulePtr()

static TModuleInterface * FModuleManager::LoadModulePtr ( const FName  InModuleName)
inlinestatic

Loads a module by name.

Parameters
ModuleNameThe module to find and load.
Returns
The interface to the module, or nullptr if the module was not found.
See also
GetModulePtr, GetModuleChecked, LoadModuleChecked

◆ LoadModuleWithCallback()

bool FModuleManager::LoadModuleWithCallback ( const FName  InModuleName,
FOutputDevice Ar 
)

Loads a module in memory then calls PostLoad.

Parameters
InModuleNameThe name of the module to load.
ArThe archive to receive error messages, if any.
Returns
true on success, false otherwise.
See also
UnloadOrAbandonModuleWithCallback

◆ LoadModuleWithFailureReason()

IModuleInterface * FModuleManager::LoadModuleWithFailureReason ( const FName  InModuleName,
EModuleLoadResult OutFailureReason,
ELoadModuleFlags  InLoadModuleFlags = ELoadModuleFlags::None 
)

Loads the specified module and returns a result.

Parameters
InModuleNameThe base name of the module file. Should not include path, extension or platform/configuration info. This is just the "module name" part of the module file name. Names should be globally unique.
OutFailureReasonWill contain the result.
InLoadModuleFlagsOptional flags for module load operation.
Returns
The loaded module (null if the load operation failed).
See also
AbandonModule, IsModuleLoaded, LoadModule, LoadModuleChecked, LoadModulePtr, UnloadModule

◆ MakeUniqueModuleFilename()

void FModuleManager::MakeUniqueModuleFilename ( const FName  InModuleName,
FString &  UniqueSuffix,
FString &  UniqueModuleFileName 
) const

Generates a unique file name for the specified module name by adding a random suffix and checking for file collisions.

◆ ModuleExists()

bool FModuleManager::ModuleExists ( const TCHAR ModuleName,
FString *  OutModuleFilePath = nullptr 
) const

Determines if a module with the given name exists, regardless of whether it is currently loaded.

Parameters
ModuleNameName of the module to look for.
OutModuleFilePathIf non-null, the assembly filename of the module will be written. Empty string will be written if ModuleExists returns false or assembly is unknown due to e.g. Monolithic executable.
Returns
Whether the module exists.

◆ OnCheckLiveObjectsInModulesCallback()

TDelegateRegistration< bool(TConstArrayView< FName >)> & FModuleManager::OnCheckLiveObjectsInModulesCallback ( )
inline

Gets a delegate that is executed whenever we need to confirm that modules can be safely unloaded.

Returns
The delegate.

◆ OnModulesChanged()

TTSMulticastDelegateRegistration< void(FName ModuleName, EModuleChangeReason ChangeReason)> & FModuleManager::OnModulesChanged ( )
inline

◆ OnModulesUnloaded()

TMulticastDelegateRegistration< void(TConstArrayView< FName >)> & FModuleManager::OnModulesUnloaded ( )
inline

Gets a multicast delegate that is executed when any UObjects need destroying before modules are unloaded.

Returns
The delegate.

◆ OnObjectCleanup()

void FModuleManager::OnObjectCleanup ( )

Signal that objects used by an unloading dynamic library should be cleaned up now

◆ OnProcessLoadedObjectsCallback()

TMulticastDelegateRegistration< void(FName, bool)> & FModuleManager::OnProcessLoadedObjectsCallback ( )
inline

◆ operator=()

FModuleManager & FModuleManager::operator= ( const FModuleManager )
delete

◆ QueryModule()

bool FModuleManager::QueryModule ( const FName  InModuleName,
FModuleStatus OutModuleStatus 
) const

Queries information about a specific module name.

Parameters
InModuleNameModule to query status for.
OutModuleStatusStatus of the specified module.
Returns
true if the module was found and the OutModuleStatus is valid, false otherwise.
See also
QueryModules

◆ QueryModules()

void FModuleManager::QueryModules ( TArray< FModuleStatus > &  OutModuleStatuses) const

Queries information about all of the currently known modules.

Parameters
OutModuleStatusesStatus of all modules. Note that the array will be cleared before the results are added to it.
See also
QueryModule

◆ RefreshModuleFilenameFromManifest()

void FModuleManager::RefreshModuleFilenameFromManifest ( const FName  InModuleName)

◆ RegisterStaticallyLinkedModule()

void FModuleManager::RegisterStaticallyLinkedModule ( const FLazyName  InModuleName,
FInitializeStaticallyLinkedModuleRaw InInitializer 
)
static

Registers an initializer for a module that is statically linked.

Parameters
InModuleNameThe name of this module.
InInitializerDelegateThe delegate that will be called to initialize an instance of this module.

◆ ResetModulePathsCache()

void FModuleManager::ResetModulePathsCache ( )

Clears module path cache

◆ SaveCurrentStateForBootstrap()

void FModuleManager::SaveCurrentStateForBootstrap ( const TCHAR Filename)

Save the current module manager's state into a file for bootstrapping other processes.

◆ SetGameBinariesDirectory()

void FModuleManager::SetGameBinariesDirectory ( const TCHAR InDirectory)

Set the game binaries directory

Parameters
InDirectoryThe game binaries directory.

◆ SetModuleFilename()

void FModuleManager::SetModuleFilename ( FName  ModuleName,
const FString &  Filename 
)

Sets the filename for a module. The module is not reloaded immediately, but the new name will be used for subsequent unload/load events.

◆ StartProcessingNewlyLoadedObjects()

void FModuleManager::StartProcessingNewlyLoadedObjects ( )

Called by the engine at startup to let the Module Manager know that it's now safe to process new UObjects discovered by loading C++ modules.

◆ TearDown()

void FModuleManager::TearDown ( )
static

Destroys singleton if it exists. Get() must not be called after Destroy().

◆ UnloadModule()

bool FModuleManager::UnloadModule ( const FName  InModuleName,
bool  bIsShutdown = false,
bool  bAllowUnloadCode = true 
)

Unloads a specific module NOTE: You can manually unload a module before the normal shutdown occurs with this, but be careful as you may be unloading another module's dependency too early!

Parameters
InModuleNameThe name of the module to unload. Should not include path, extension or platform/configuration info. This is just the "module name" part of the module file name.
bIsShutdownIs this unload module call occurring at shutdown (default = false).
bAllowUnloadCodeAllow unloading of code library if possible (default = true).
Returns
true if module was unloaded successfully, false otherwise.
See also
AbandonModule, IsModuleLoaded, LoadModule, LoadModuleWithFailureReason

◆ UnloadModulesAtShutdown()

void FModuleManager::UnloadModulesAtShutdown ( )

Unloads modules during the shutdown process. Modules are unloaded in reverse order to when their StartupModule() FINISHES. The practical implication of this is that if module A depends on another module B, and A loads B during A's StartupModule, that B will actually get Unloaded after A during shutdown. This allows A's ShutdownModule() call to still reference module B. You can manually unload a module yourself which will change this ordering, but be careful as you may be unloading another module's dependency!

This method is Usually called at various points while exiting an application.

◆ UnloadOrAbandonModuleWithCallback()

void FModuleManager::UnloadOrAbandonModuleWithCallback ( const FName  InModuleName,
FOutputDevice Ar 
)

Calls PreUnload then either unloads or abandons a module in memory, depending on whether the module supports unloading.

Parameters
InModuleNameThe name of the module to unload.
ArThe archive to receive error messages, if any.
See also
LoadModuleWithCallback

Friends And Related Symbol Documentation

◆ operator<<

FArchive & operator<< ( FArchive Ar,
FModuleManager ModuleManager 
)
friend

◆ UE::Core::Private::GetModuleManagerSingleton


The documentation for this class was generated from the following files: