engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | 友元 | 所有成员列表
FModuleManager类 参考

Implements the module manager. 更多...

#include <ModuleManager.h>

+ 类 FModuleManager 继承关系图:

Public 成员函数

void AbandonModule (const FName InModuleName)
 Abandons a loaded module, leaving it loaded in memory but no longer tracking it in the module manager. 更多...
 
void AbandonModuleWithCallback (const FName InModuleName)
 Calls PreUnload then abandons a module in memory. 更多...
 
void AddBinariesDirectory (const TCHAR *InDirectory, bool bIsGameDirectory)
 Adds an engine binaries directory.
 
void AddExtraBinarySearchPaths ()
 Add any extra search paths that may be required
 
void AddModule (const FName InModuleName)
 Adds a module to our list of modules, unless it's already known. 更多...
 
 DECLARE_DELEGATE_RetVal (IModuleInterface *, FInitializeStaticallyLinkedModule) void RegisterStaticallyLinkedModule(const FLazyName InModuleName
 Delegate that's used by the module manager to initialize a registered module that we statically linked with (monolithic only) 更多...
 
 DECLARE_DELEGATE_RetVal_OneParam (bool, FIsPackageLoadedCallback, FName)
 Gets a delegate that is executed when a module containing UObjects has been loaded. 更多...
 
 DECLARE_EVENT_TwoParams (FModuleManager, FModulesChangedEvent, FName, EModuleChangeReason)
 Gets an event delegate that is executed when the set of known modules changed, i.e. 更多...
 
 DECLARE_EVENT_TwoParams (FModuleManager, ProcessLoadedObjectsEvent, FName, bool)
 Gets a multicast delegate that is executed when any UObjects need processing after a module was loaded. 更多...
 
bool DoesLoadedModuleHaveUObjects (const FName ModuleName) const
 Determines whether the specified module contains UObjects. 更多...
 
void FindModules (const TCHAR *WildcardWithoutExtension, TArray< FName > &OutModules) const
 Finds module files on the disk for loadable modules matching the specified wildcard. 更多...
 
FString GetGameBinariesDirectory () const
 Gets the game binaries directory
 
IModuleInterface * GetModule (const FName InModuleName)
 Gets the specified module. 更多...
 
int32 GetModuleCount () const
 Gets the number of loaded modules. 更多...
 
FString GetModuleFilename (FName ModuleName) const
 Gets the filename for a module. 更多...
 
bool HasAnyOverridenModuleFilename () const
 Determines if any non-default module instances are loaded (eg. 更多...
 
bool IsModuleLoaded (const FName InModuleName) const
 Checks whether the specified module is currently loaded. 更多...
 
bool IsModuleUpToDate (const FName InModuleName) const
 Checks to see if the specified module exists and is compatible with the current engine version. 更多...
 
IModuleInterface * LoadModule (const FName InModuleName)
 Loads the specified module. 更多...
 
IModuleInterface & LoadModuleChecked (const FName InModuleName)
 Loads the specified module, checking to ensure it exists. 更多...
 
bool LoadModuleWithCallback (const FName InModuleName, FOutputDevice &Ar)
 Loads a module in memory then calls PostLoad. 更多...
 
IModuleInterface * LoadModuleWithFailureReason (const FName InModuleName, EModuleLoadResult &OutFailureReason)
 Loads the specified module and returns a result. 更多...
 
void 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 ModuleExists (const TCHAR *ModuleName) const
 Determines if a module with the given name exists, regardless of whether it is currently loaded. 更多...
 
bool QueryModule (const FName InModuleName, FModuleStatus &OutModuleStatus) const
 Queries information about a specific module name. 更多...
 
void QueryModules (TArray< FModuleStatus > &OutModuleStatuses) const
 Queries information about all of the currently known modules. 更多...
 
void ResetModulePathsCache ()
 Clears module path cache
 
void SaveCurrentStateForBootstrap (const TCHAR *Filename)
 Save the current module manager's state into a file for bootstrapping other processes.
 
void SetGameBinariesDirectory (const TCHAR *InDirectory)
 Set the game binaries directory 更多...
 
void SetModuleFilename (FName ModuleName, const FString &Filename)
 Sets the filename for a module. 更多...
 
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.
 
bool UnloadModule (const FName InModuleName, bool bIsShutdown=false)
 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! 更多...
 
void UnloadModulesAtShutdown ()
 Unloads modules during the shutdown process. 更多...
 
void UnloadOrAbandonModuleWithCallback (const FName InModuleName, FOutputDevice &Ar)
 Calls PreUnload then either unloads or abandons a module in memory, depending on whether the module supports unloading. 更多...
 

静态 Public 成员函数

static FModuleManager & Get ()
 Gets the singleton instance of the module manager. 更多...
 
template<typename TModuleInterface >
static TModuleInterface & GetModuleChecked (const FName ModuleName)
 Gets a module by name, checking to ensure it exists. 更多...
 
template<typename TModuleInterface >
static FORCEINLINE TModuleInterface * GetModulePtr (const FName ModuleName)
 Gets a module by name. 更多...
 
static const TCHAR * GetUBTConfiguration ()
 Gets the build configuration for compiling modules, as required by UBT. 更多...
 
template<typename TModuleInterface >
static TModuleInterface & LoadModuleChecked (const FName InModuleName)
 Loads a module by name, checking to ensure it exists. 更多...
 
template<typename TModuleInterface >
static TModuleInterface * LoadModulePtr (const FName InModuleName)
 Loads a module by name. 更多...
 
static void TearDown ()
 Destroys singleton if it exists. 更多...
 

友元

struct TOptional< FModuleManager >
 

详细描述

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().

成员函数说明

◆ 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.

参数
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.
参见
IsModuleLoaded, LoadModule, LoadModuleWithFailureReason, UnloadModule

◆ AbandonModuleWithCallback()

void FModuleManager::AbandonModuleWithCallback ( const FName  InModuleName)

Calls PreUnload then abandons a module in memory.

参数
InModuleNameThe name of the module to unload.
参见
LoadModuleWithCallback

◆ AddModule()

void FModuleManager::AddModule ( const FName  InModuleName)

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

参数
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.

◆ DECLARE_DELEGATE_RetVal()

FModuleManager::DECLARE_DELEGATE_RetVal ( IModuleInterface *  ,
FInitializeStaticallyLinkedModule   
) const

Delegate that's used by the module manager to initialize a registered module that we statically linked with (monolithic only)

Registers an initializer for a module that is statically linked.

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

◆ 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.

返回
The event delegate.

◆ DECLARE_EVENT_TwoParams() [1/2]

FModuleManager::DECLARE_EVENT_TwoParams ( FModuleManager  ,
FModulesChangedEvent  ,
FName  ,
EModuleChangeReason   
)

Gets an event delegate that is executed when the set of known modules changed, i.e.

upon module load or unload.

The first parameter is the name of the module that changed. The second parameter is the reason for the change.

返回
The event delegate.

◆ DECLARE_EVENT_TwoParams() [2/2]

FModuleManager::DECLARE_EVENT_TwoParams ( FModuleManager  ,
ProcessLoadedObjectsEvent  ,
FName  ,
bool   
)

Gets a multicast delegate that is executed when any UObjects need processing after a module was loaded.

返回
The 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.

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

◆ FindModules()

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

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

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

◆ Get()

static FModuleManager & FModuleManager::Get ( )
static

Gets the singleton instance of the module manager.

返回
The module manager instance.

◆ GetModule()

IModuleInterface * FModuleManager::GetModule ( const FName  InModuleName)

Gets the specified module.

参数
InModuleNameName of the module to return.
返回
The module, or nullptr if the module is not loaded.
参见
GetModuleChecked, GetModulePtr

◆ GetModuleChecked()

template<typename TModuleInterface >
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.

参数
ModuleNameThe module to get.
返回
The interface to the module.
参见
GetModulePtr, LoadModulePtr, LoadModuleChecked

◆ GetModuleCount()

int32 FModuleManager::GetModuleCount ( ) const

Gets the number of loaded modules.

返回
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()

template<typename TModuleInterface >
static FORCEINLINE TModuleInterface * FModuleManager::GetModulePtr ( const FName  ModuleName)
inlinestatic

Gets a module by name.

参数
ModuleNameThe module to get.
返回
The interface to the module, or nullptr if the module was not found.
参见
GetModuleChecked, LoadModulePtr, LoadModuleChecked

◆ GetUBTConfiguration()

static const TCHAR * FModuleManager::GetUBTConfiguration ( )
static

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

返回
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.

参数
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.
返回
true if module is currently loaded, false otherwise.
参见
AbandonModule, LoadModule, LoadModuleWithFailureReason, UnloadModule

◆ IsModuleUpToDate()

bool FModuleManager::IsModuleUpToDate ( const FName  InModuleName) const

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

参数
InModuleNameThe base name of the module file.
返回
true if module exists and is up to date, false otherwise.

◆ LoadModule()

IModuleInterface * FModuleManager::LoadModule ( const FName  InModuleName)

Loads the specified module.

参数
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.
返回
The loaded module, or nullptr if the load operation failed.
参见
AbandonModule, IsModuleLoaded, LoadModuleChecked, LoadModulePtr, LoadModuleWithFailureReason, UnloadModule

◆ LoadModuleChecked() [1/2]

IModuleInterface & FModuleManager::LoadModuleChecked ( const FName  InModuleName)

Loads the specified module, checking to ensure it exists.

参数
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.
返回
The loaded module, or nullptr if the load operation failed.
参见
AbandonModule, IsModuleLoaded, LoadModuleChecked, LoadModulePtr, LoadModuleWithFailureReason, UnloadModule

◆ LoadModuleChecked() [2/2]

template<typename TModuleInterface >
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.

参数
ModuleNameThe module to find and load
返回
Returns the module interface, casted to the specified typename
参见
GetModulePtr, LoadModulePtr, LoadModuleChecked

◆ LoadModulePtr()

template<typename TModuleInterface >
static TModuleInterface * FModuleManager::LoadModulePtr ( const FName  InModuleName)
inlinestatic

Loads a module by name.

参数
ModuleNameThe module to find and load.
返回
The interface to the module, or nullptr if the module was not found.
参见
GetModulePtr, GetModuleChecked, LoadModuleChecked

◆ LoadModuleWithCallback()

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

Loads a module in memory then calls PostLoad.

参数
InModuleNameThe name of the module to load.
ArThe archive to receive error messages, if any.
返回
true on success, false otherwise.
参见
UnloadOrAbandonModuleWithCallback

◆ LoadModuleWithFailureReason()

IModuleInterface * FModuleManager::LoadModuleWithFailureReason ( const FName  InModuleName,
EModuleLoadResult &  OutFailureReason 
)

Loads the specified module and returns a result.

参数
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.
返回
The loaded module (null if the load operation failed).
参见
AbandonModule, IsModuleLoaded, LoadModule, LoadModuleChecked, LoadModulePtr, UnloadModule

◆ ModuleExists()

bool FModuleManager::ModuleExists ( const TCHAR *  ModuleName) const

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

参数
ModuleNameName of the module to look for.
返回
Whether the module exists.

◆ QueryModule()

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

Queries information about a specific module name.

参数
InModuleNameModule to query status for.
OutModuleStatusStatus of the specified module.
返回
true if the module was found and the OutModuleStatus is valid, false otherwise.
参见
QueryModules

◆ QueryModules()

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

Queries information about all of the currently known modules.

参数
OutModuleStatusesStatus of all modules.
参见
QueryModule

◆ SetGameBinariesDirectory()

void FModuleManager::SetGameBinariesDirectory ( const TCHAR *  InDirectory)

Set the game binaries directory

参数
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.

◆ TearDown()

static 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 
)

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!

参数
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).
返回
true if module was unloaded successfully, false otherwise.
参见
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.

参数
InModuleNameThe name of the module to unload.
ArThe archive to receive error messages, if any.
参见
LoadModuleWithCallback

该类的文档由以下文件生成: