AssetManagerClassName
AssetManagerClassName
#Overview
name: AssetManagerClassName
The value of this variable can be defined or overridden in .ini config files. 2
.ini config files referencing this setting variable.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of AssetManagerClassName is to specify the class that will be spawned as the global AssetManager in Unreal Engine 5. This setting variable is crucial for asset management and loading within the engine.
AssetManagerClassName is primarily used by the Engine subsystem, specifically in the initialization and setup of the asset management system. It’s also referenced in the CommonUI plugin, indicating its importance for UI-related asset management.
The value of this variable is set in the “defaultengine.ini” configuration file. It’s a global config property, meaning it can be adjusted per game project.
This variable interacts closely with the AssetManager object, which is instantiated based on the class specified by AssetManagerClassName. It’s also used in conjunction with the GetStreamableManager() function, which is part of the asset loading and management system.
Developers must be aware that:
- This variable must be set to a valid class name in the config file.
- Changing this value requires a restart of the engine to take effect.
- If left empty, no AssetManager will be spawned, which could lead to issues with asset loading and management.
Best practices when using this variable include:
- Always ensure it’s set to a valid class that inherits from UAssetManager.
- Consider creating a game-specific AssetManager class (like ULyraAssetManager in the example) to handle game-specific asset loading logic.
- Be cautious when modifying this value, as it affects the entire asset management system of the game.
- Use the AssetManager instance (accessible via UAssetManager::Get()) for asset-related operations rather than bypassing it.
- If overriding the default AssetManager, ensure all necessary functionality is properly implemented in the custom class.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:136, section: [/Script/Engine.Engine]
- INI Section:
/Script/Engine.Engine
- Raw value:
/Script/Engine.AssetManager
- Is Array:
False
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:26, section: [/Script/Engine.Engine]
- INI Section:
/Script/Engine.Engine
- Raw value:
/Script/LyraGame.LyraAssetManager
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/CommonUIModule.cpp:128
Scope (from outer to inner):
file
function FStreamableManager& FCommonUIModule::GetStreamableManager
Source code excerpt:
FStreamableManager& FCommonUIModule::GetStreamableManager() const
{
// CommonUI depends on there being an AssetManagerClassName defined in defaultengine.ini
return UAssetManager::Get().GetStreamableManager();
}
TAsyncLoadPriority FCommonUIModule::GetLazyLoadPriority() const
{
return 0;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Engine.h:864
Scope (from outer to inner):
file
class class UEngine : public UObject , public FExec
Source code excerpt:
/** Sets the class to spawn as the global AssetManager, configurable per game. If empty, it will not spawn one */
UPROPERTY(globalconfig, noclear, EditAnywhere, Category=DefaultClasses, meta=(MetaClass="/Script/CoreUObject.Object", DisplayName="Asset Manager Class", ConfigRestartRequired=true), AdvancedDisplay)
FSoftClassPath AssetManagerClassName;
/** A UObject spawned at initialization time to handle runtime asset loading and management */
UPROPERTY()
TObjectPtr<class UAssetManager> AssetManager;
/** A global default texture. */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:3325
Scope (from outer to inner):
file
function void UEngine::InitializeObjectReferences
Source code excerpt:
{
UClass* SingletonClass = nullptr;
if (AssetManagerClassName.ToString().Len() > 0)
{
SingletonClass = LoadClass<UObject>(nullptr, *AssetManagerClassName.ToString());
}
if (!SingletonClass)
{
UE_LOG(LogEngine, Fatal, TEXT("Engine config value AssetManagerClassName '%s' is not a valid class name."), *AssetManagerClassName.ToString());
}
AssetManager = NewObject<UAssetManager>(this, SingletonClass);
check(AssetManager);
if (!FParse::Param(FCommandLine::Get(), TEXT("SkipAssetScan")))
{
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/System/LyraAssetManager.h:23
Scope: file
Source code excerpt:
* Game implementation of the asset manager that overrides functionality and stores game-specific types.
* It is expected that most games will want to override AssetManager as it provides a good place for game-specific loading logic.
* This class is used by setting 'AssetManagerClassName' in DefaultEngine.ini.
*/
UCLASS(Config = Game)
class ULyraAssetManager : public UAssetManager
{
GENERATED_BODY()
public:
ULyraAssetManager();
// Returns the AssetManager singleton object.
static ULyraAssetManager& Get();