![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <ModuleManager.h>
Inheritance diagram for FModuleManager:Public Types | |
| using | instead = TTSMulticastDelegate< void(FName ModuleName, EModuleChangeReason ChangeReason)> |
| using | instead = TMulticastDelegate< void(FName, bool)> |
Static Public Member Functions | |
| static CORE_API FModuleManager & | Get () |
| static CORE_API void | TearDown () |
| template<typename TModuleInterface > | |
| static TModuleInterface & | GetModuleChecked (const FName ModuleName) |
| template<typename TModuleInterface > | |
| static UE_FORCEINLINE_HINT TModuleInterface * | GetModulePtr (const FName ModuleName) |
| template<typename TModuleInterface > | |
| static TModuleInterface & | LoadModuleChecked (const FName InModuleName) |
| template<typename TModuleInterface > | |
| static TModuleInterface * | LoadModulePtr (const FName InModuleName) |
| static CORE_API void | RegisterStaticallyLinkedModule (const FLazyName InModuleName, FInitializeStaticallyLinkedModuleRaw *InInitializer) |
| static CORE_API const TCHAR * | GetUBTConfiguration () |
Protected Member Functions | |
| virtual CORE_API bool | Exec_Dev (UWorld *Inworld, const TCHAR *Cmd, FOutputDevice &Ar) override |
Friends | |
| TOptional< FModuleManager > & | UE::Core::Private::GetModuleManagerSingleton () |
| FArchive & | operator<< (FArchive &Ar, FModuleManager &ModuleManager) |
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().
| using FModuleManager::instead = TTSMulticastDelegate<void(FName ModuleName, EModuleChangeReason ChangeReason)> |
| using FModuleManager::instead = TMulticastDelegate<void(FName, bool)> |
| FModuleManager::~FModuleManager | ( | ) |
Destructor.
| FModuleManager::FModuleManager | ( | FPrivateToken | ) |
Hidden constructor.
Use the static Get function to return the singleton instance.
|
delete |
Abandons a loaded module, leaving it loaded in memory but no longer tracking it in the module manager.
| InModuleName | The 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. |
Calls PreUnload then abandons a module in memory.
| InModuleName | The name of the module to unload. |
Adds an engine binaries directory.
| void FModuleManager::AddExtraBinarySearchPaths | ( | ) |
Add any extra search paths that may be required
Adds a module to our list of modules, unless it's already known.
| InModuleName | The 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. |
| void FModuleManager::AddModuleToModulesList | ( | const FName | InModuleName, |
| FModuleManager::ModuleInfoRef & | ModuleInfo | ||
| ) |
| 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.
| 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.
Determines whether the specified module contains UObjects. The module must already be loaded into memory before calling this function.
| ModuleName | Name of the loaded module to check. |
|
overrideprotectedvirtual |
Implementation of Exec that is only called in non-shipping targets
Reimplemented from FExec.
| void FModuleManager::FindModules | ( | const TCHAR * | WildcardWithoutExtension, |
| TArray< FModuleDiskInfo > & | OutModules | ||
| ) | const |
| void FModuleManager::FindModules | ( | const TCHAR * | WildcardWithoutExtension, |
| TArray< FName > & | OutModules | ||
| ) | const |
Finds module files on the disk for loadable modules matching the specified wildcard.
| WildcardWithoutExtension | Filename part (no path, no extension, no build config info) to search for. |
| OutModules | List of modules found. |
|
static |
Gets the singleton instance of the module manager.
| FString FModuleManager::GetGameBinariesDirectory | ( | ) | const |
Gets the game binaries directory
| IModuleInterface * FModuleManager::GetModule | ( | const FName | InModuleName | ) |
Gets the specified module.
| InModuleName | Name of the module to return. |
|
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.
| ModuleName | The module to get. |
| int32 FModuleManager::GetModuleCount | ( | ) | const |
Gets the number of loaded modules.
| 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.
|
inlinestatic |
Gets a module by name.
| ModuleName | The module to get. |
|
static |
Gets the build configuration for compiling modules, as required by UBT.
| bool FModuleManager::HasAnyOverridenModuleFilename | ( | ) | const |
Determines if any non-default module instances are loaded (eg. hot reloaded modules)
Checks whether the specified module is currently loaded.
This is an O(1) operation.
| InModuleName | The 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. |
Checks whether a module is compiled-in, or currently loaded, with all code inside safe to call.
| InModuleName | Name of the module to check. |
Checks to see if the specified module exists and is compatible with the current engine version.
| InModuleName | The base name of the module file. |
|
inline |
| IModuleInterface * FModuleManager::LoadModule | ( | const FName | InModuleName, |
| ELoadModuleFlags | InLoadModuleFlags = ELoadModuleFlags::None |
||
| ) |
Loads the specified module.
| InModuleName | The 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. |
| InLoadModuleFlags | Optional flags for module load operation. |
Will load the binary without doing initialization. Calling this will not make it possible to unload the module again
| IModuleInterface & FModuleManager::LoadModuleChecked | ( | const FName | InModuleName | ) |
Loads the specified module, checking to ensure it exists.
| InModuleName | The 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. |
|
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.
| ModuleName | The module to find and load |
|
inlinestatic |
Loads a module by name.
| ModuleName | The module to find and load. |
| bool FModuleManager::LoadModuleWithCallback | ( | const FName | InModuleName, |
| FOutputDevice & | Ar | ||
| ) |
Loads a module in memory then calls PostLoad.
| InModuleName | The name of the module to load. |
| Ar | The archive to receive error messages, if any. |
| IModuleInterface * FModuleManager::LoadModuleWithFailureReason | ( | const FName | InModuleName, |
| EModuleLoadResult & | OutFailureReason, | ||
| ELoadModuleFlags | InLoadModuleFlags = ELoadModuleFlags::None |
||
| ) |
Loads the specified module and returns a result.
| InModuleName | The 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. |
| OutFailureReason | Will contain the result. |
| InLoadModuleFlags | Optional flags for module load operation. |
| 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.
| 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.
| ModuleName | Name of the module to look for. |
| OutModuleFilePath | If 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. |
|
inline |
Gets a delegate that is executed whenever we need to confirm that modules can be safely unloaded.
|
inline |
|
inline |
Gets a multicast delegate that is executed when any UObjects need destroying before modules are unloaded.
| void FModuleManager::OnObjectCleanup | ( | ) |
Signal that objects used by an unloading dynamic library should be cleaned up now
|
inline |
|
delete |
| bool FModuleManager::QueryModule | ( | const FName | InModuleName, |
| FModuleStatus & | OutModuleStatus | ||
| ) | const |
Queries information about a specific module name.
| InModuleName | Module to query status for. |
| OutModuleStatus | Status of the specified module. |
| void FModuleManager::QueryModules | ( | TArray< FModuleStatus > & | OutModuleStatuses | ) | const |
Queries information about all of the currently known modules.
| OutModuleStatuses | Status of all modules. Note that the array will be cleared before the results are added to it. |
|
static |
Registers an initializer for a module that is statically linked.
| InModuleName | The name of this module. |
| InInitializerDelegate | The delegate that will be called to initialize an instance of this module. |
| void FModuleManager::ResetModulePathsCache | ( | ) |
Clears module path cache
Save the current module manager's state into a file for bootstrapping other processes.
Set the game binaries directory
| InDirectory | The game binaries directory. |
Sets the filename for a module. The module is not reloaded immediately, but the new name will be used for subsequent unload/load events.
| 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.
|
static |
| 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!
| InModuleName | The 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. |
| bIsShutdown | Is this unload module call occurring at shutdown (default = false). |
| bAllowUnloadCode | Allow unloading of code library if possible (default = true). |
| 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.
| 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.
| InModuleName | The name of the module to unload. |
| Ar | The archive to receive error messages, if any. |
|
friend |
|
friend |