Navigation
API > API/Runtime > API/Runtime/Core
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().
| Name | FModuleManager |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Modules/ModuleManager.h |
| Include Path | #include "Modules/ModuleManager.h" |
Syntax
class FModuleManager : private FSelfRegisteringExec
Inheritance Hierarchy
- FExec → FSelfRegisteringExec → FModuleManager
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FModuleManager
(
FPrivateToken |
Hidden constructor.Use the static Get function to return the singleton instance. | Modules/ModuleManager.h | |
FModuleManager
(
const FModuleManager& |
Modules/ModuleManager.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FModuleManager() |
Destructor. | Modules/ModuleManager.h |
Classes
| Name | Remarks |
|---|---|
| FModuleInfo | Information about a single module (may or may not be loaded.) |
Structs
| Name | Remarks |
|---|---|
| FPrivateToken |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FInitializeStaticallyLinkedModule | TBaseDelegate_NoParams< IModuleInterface * > | Delegate that's used by the module manager to initialize a registered module that we statically linked with (monolithic only) | Modules/ModuleManager.h |
| FIsPackageLoadedCallback | TBaseDelegate_OneParam< bool, FName > | Gets a delegate that is executed when a module containing UObjects has been loaded. | Modules/ModuleManager.h |
| FModuleMap | TMap< FName, ModuleInfoRef > | Type definition for maps of module names to module infos. | Modules/ModuleManager.h |
| ModuleInfoPtr | TSharedPtr< FModuleInfo, ESPMode::ThreadSafe > | Modules/ModuleManager.h | |
| ModuleInfoRef | TSharedRef< FModuleInfo, ESPMode::ThreadSafe > | Modules/ModuleManager.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bCanProcessNewlyLoadedObjects | bool | True if module manager should automatically register new UObjects discovered while loading C++ modules | Modules/ModuleManager.h | |
| bExtraBinarySearchPathsAdded | bool | True once AddExtraBinarySearchPaths has been called | Modules/ModuleManager.h | |
| BuildId | TOptional< FString > | ID used to validate module manifests. | Modules/ModuleManager.h | |
| CheckLiveObjectsInModulesCallback | TDelegate< bool(TConstArrayView< FName >)> | Delegate called to check whether any module to delay-unload still has live objects. | Modules/ModuleManager.h | |
| EngineBinariesDirectories | TArray< FString > | Array of engine binaries directories. | Modules/ModuleManager.h | |
| GameBinariesDirectories | TArray< FString > | Array of game binaries directories. | Modules/ModuleManager.h | |
| IsPackageLoaded | FIsPackageLoadedCallback | When module manager is linked against an application that supports UObjects, this delegate will be primed at startup to provide information about whether a UObject package is loaded into memory. | Modules/ModuleManager.h | |
| ModulePathsCache | TMap< FName, FString > | Cache of known module paths. Used for performance. Can increase editor startup times by up to 30% | Modules/ModuleManager.h | |
| Modules | FModuleMap | Map of all modules. | Modules/ModuleManager.h | |
| ModulesChangedEvent | TTSMulticastDelegate< void(FName ModuleName, EModuleChangeReason ChangeReason)> | Multicast delegate that will broadcast a notification when modules are loaded, unloaded, or our set of known modules changes | Modules/ModuleManager.h | |
| ModulesCriticalSection | FCriticalSection | Critical section object controlling R/W access to Modules. | Modules/ModuleManager.h | |
| PendingEngineBinariesDirectories | TArray< FString > | Modules/ModuleManager.h | ||
| PendingGameBinariesDirectories | TArray< FString > | Modules/ModuleManager.h | ||
| PendingStaticallyLinkedModuleInitializers | TArray< TPair< FLazyName, FInitializeStaticallyLinkedModule >, TInlineAllocator< 16 > > | Pending registrations of module names We use an array here to stop comparisons (and thus FNames being constructed) when they are registered. | Modules/ModuleManager.h | |
| ProcessLoadedObjectsCallback | TMulticastDelegate< void(FName, bool)> | Multicast delegate called to process any new loaded objects. | Modules/ModuleManager.h | |
| RemoveLoadedObjectsCallback | TMulticastDelegate< void(TConstArrayView< FName >)> | Multicast delegate called to remove any loaded objects for a list of modules. | Modules/ModuleManager.h | |
| StaticallyLinkedModuleInitializers | TMap< FName, FInitializeStaticallyLinkedModule > | Map of module names to a delegate that can initialize each respective statically linked module | Modules/ModuleManager.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AbandonModule
(
const FName InModuleName |
Abandons a loaded module, leaving it loaded in memory but no longer tracking it in the module manager. | Modules/ModuleManager.h | |
void AbandonModuleWithCallback
(
const FName InModuleName |
Calls PreUnload then abandons a module in memory. | Modules/ModuleManager.h | |
void AddBinariesDirectory
(
const TCHAR* InDirectory, |
Adds an engine binaries directory. | Modules/ModuleManager.h | |
void AddExtraBinarySearchPaths() |
Add any extra search paths that may be required | Modules/ModuleManager.h | |
void AddModule
(
const FName InModuleName |
Adds a module to our list of modules, unless it's already known. | Modules/ModuleManager.h | |
void AddModuleToModulesList
(
const FName InModuleName, |
Modules/ModuleManager.h | ||
bool DoesLoadedModuleHaveUObjects
(
const FName ModuleName |
Determines whether the specified module contains UObjects. | Modules/ModuleManager.h | |
void FindModules
(
const TCHAR* WildcardWithoutExtension, |
Finds module files on the disk for loadable modules matching the specified wildcard. | Modules/ModuleManager.h | |
void FindModules
(
const TCHAR* WildcardWithoutExtension, |
Modules/ModuleManager.h | ||
FString GetGameBinariesDirectory() |
Gets the game binaries directory | Modules/ModuleManager.h | |
IModuleInterface * GetModule
(
const FName InModuleName |
Gets the specified module. | Modules/ModuleManager.h | |
int32 GetModuleCount() |
Gets the number of loaded modules. | Modules/ModuleManager.h | |
FString GetModuleFilename
(
FName ModuleName |
Gets the filename for a module. | Modules/ModuleManager.h | |
bool HasAnyOverridenModuleFilename() |
Determines if any non-default module instances are loaded (eg. hot reloaded modules) | Modules/ModuleManager.h | |
bool IsModuleLoaded
(
const FName InModuleName |
Checks whether the specified module is currently loaded.This is an O(1) operation. | Modules/ModuleManager.h | |
bool IsModuleUpToDate
(
const FName InModuleName |
Checks to see if the specified module exists and is compatible with the current engine version. | Modules/ModuleManager.h | |
FIsPackageLoadedCallback & IsPackageLoadedCallback() |
Modules/ModuleManager.h | ||
IModuleInterface * LoadModule
(
const FName InModuleName, |
Loads the specified module. | Modules/ModuleManager.h | |
void LoadModuleBinaryOnly
(
FName ModuleName |
Will load the binary without doing initialization. | Modules/ModuleManager.h | |
IModuleInterface & LoadModuleChecked
(
const FName InModuleName |
Loads the specified module, checking to ensure it exists. | Modules/ModuleManager.h | |
bool LoadModuleWithCallback
(
const FName InModuleName, |
Loads a module in memory then calls PostLoad. | Modules/ModuleManager.h | |
IModuleInterface * LoadModuleWithFailureReason
(
const FName InModuleName, |
Loads the specified module and returns a result. | Modules/ModuleManager.h | |
void MakeUniqueModuleFilename
(
const FName InModuleName, |
Generates a unique file name for the specified module name by adding a random suffix and checking for file collisions. | Modules/ModuleManager.h | |
bool ModuleExists
(
const TCHAR* ModuleName, |
Determines if a module with the given name exists, regardless of whether it is currently loaded. | Modules/ModuleManager.h | |
TDelegateRegistration< bool(TConstArrayView< FName >)> & OnCheckLiveObjectsInModulesCallback() |
Gets a delegate that is executed whenever we need to confirm that modules can be safely unloaded. | Modules/ModuleManager.h | |
TTSMulticastDelegateRegistration< void(FName ModuleName, EModuleChangeReason ChangeReason)> & OnModulesChanged () |
Gets a multicast delegate that is executed when the set of known modules changed, i.e. upon module load or unload. | Modules/ModuleManager.h | |
void OnObjectCleanup() |
Signal that objects used by an unloading dynamic library should be cleaned up now | Modules/ModuleManager.h | |
TMulticastDelegateRegistration< void(FName, bool)> & OnProcessLoadedObjectsCallback () |
Gets a multicast delegate that is executed when any UObjects need processing after a module was loaded. | Modules/ModuleManager.h | |
TMulticastDelegateRegistration< void(TConstArrayView< FName >)> & OnRemoveLoadedObjectsCallback() |
Gets a multicast delegate that is executed when any UObjects need destroying before modules are unloaded. | Modules/ModuleManager.h | |
bool QueryModule
(
const FName InModuleName, |
Queries information about a specific module name. | Modules/ModuleManager.h | |
void QueryModules
(
TArray< FModuleStatus >& OutModuleStatuses |
Queries information about all of the currently known modules. | Modules/ModuleManager.h | |
void RefreshModuleFilenameFromManifest
(
const FName InModuleName |
Modules/ModuleManager.h | ||
void RegisterStaticallyLinkedModule
(
const FLazyName InModuleName, |
Registers an initializer for a module that is statically linked. | Modules/ModuleManager.h | |
void ResetModulePathsCache() |
Clears module path cache | Modules/ModuleManager.h | |
void SaveCurrentStateForBootstrap
(
const TCHAR* Filename |
Save the current module manager's state into a file for bootstrapping other processes. | Modules/ModuleManager.h | |
void SetGameBinariesDirectory
(
const TCHAR* InDirectory |
Set the game binaries directory | Modules/ModuleManager.h | |
void SetModuleFilename
(
FName ModuleName, |
Sets the filename for a module. | Modules/ModuleManager.h | |
void 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. | Modules/ModuleManager.h | |
bool UnloadModule
(
const FName InModuleName, |
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! | Modules/ModuleManager.h | |
void UnloadModulesAtShutdown () |
Unloads modules during the shutdown process. | Modules/ModuleManager.h | |
void UnloadOrAbandonModuleWithCallback
(
const FName InModuleName, |
Calls PreUnload then either unloads or abandons a module in memory, depending on whether the module supports unloading. | Modules/ModuleManager.h |
Protected
Overridden from FExec
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual bool Exec_Dev
(
UWorld* InWorld, |
Implementation of Exec that is only called in non-shipping targets | Modules/ModuleManager.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FModuleManager & Get() |
Gets the singleton instance of the module manager. | Modules/ModuleManager.h | |
static TModuleInterface & GetModuleChecked
(
const FName ModuleName |
Gets a module by name, checking to ensure it exists. | Modules/ModuleManager.h | |
static TModuleInterface * GetModulePtr
(
const FName ModuleName |
Gets a module by name. | Modules/ModuleManager.h | |
static IModuleInterface * GetModulePtr_Internal
(
FName ModuleName |
Modules/ModuleManager.h | ||
static const TCHAR * GetUBTConfiguration() |
Gets the build configuration for compiling modules, as required by UBT. | Modules/ModuleManager.h | |
static TModuleInterface & LoadModuleChecked
(
const FName InModuleName |
Loads a module by name, checking to ensure it exists. | Modules/ModuleManager.h | |
static TModuleInterface * LoadModulePtr
(
const FName InModuleName |
Loads a module by name. | Modules/ModuleManager.h | |
static void TearDown() |
Destroys singleton if it exists. Get() must not be called after Destroy(). | Modules/ModuleManager.h | |
static void WarnIfItWasntSafeToLoadHere
(
const FName InModuleName |
Modules/ModuleManager.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FModuleManager & operator=
(
const FModuleManager& |
Modules/ModuleManager.h |