PrimaryAssetTypesToScan
PrimaryAssetTypesToScan
#Overview
name: PrimaryAssetTypesToScan
The value of this variable can be defined or overridden in .ini config files. 13
.ini config files referencing this setting variable.
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of PrimaryAssetTypesToScan is to define a list of asset types that should be scanned at startup by the Asset Manager system in Unreal Engine 5. This variable is crucial for managing and organizing game assets efficiently.
The Unreal Engine subsystems and modules that rely on this setting variable are:
- Asset Manager system
- Game Features subsystem
- Game Features Editor module
The value of this variable is set in multiple places:
- In the AssetManagerSettings class as a configurable property
- In the GameFeatureData class as an editable property
- It can be modified programmatically through the AddDefaultGameDataRule function in the GameFeaturesEditorModule
PrimaryAssetTypesToScan interacts with other variables and systems, such as:
- FPrimaryAssetTypeInfo structures, which define the details of each asset type to scan
- AssetManager’s scanning and initialization processes
- GameFeatureData’s asset management functionality
Developers must be aware of the following when using this variable:
- It affects startup performance, as scanning assets takes time
- Changes to this variable require reinitialization of the Asset Manager
- It’s crucial for proper organization and management of game assets
Best practices when using this variable include:
- Only include necessary asset types to minimize startup time
- Ensure consistency between project-wide settings and GameFeatureData settings
- Use the Game Features Editor module to add or modify asset types when appropriate
- Consider the impact on build sizes and runtime memory when adding new asset types to scan
- Regularly review and optimize the list of asset types to scan as the project evolves
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:222, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
PrimaryAssetType
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseGame.ini:231, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
(PrimaryAssetType="Map",AssetBaseClass=/Script/Engine.World,bHasBlueprintClasses=False,bIsEditorOnly=True,Directories=((Path="/Game/Maps")),SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=Unknown))
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseGame.ini:232, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
(PrimaryAssetType="PrimaryAssetLabel",AssetBaseClass=/Script/Engine.PrimaryAssetLabel,bHasBlueprintClasses=False,bIsEditorOnly=True,Directories=((Path="/Game")),SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=Unknown))
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:42, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
(PrimaryAssetType="Map",AssetBaseClass=/Script/Engine.World,bHasBlueprintClasses=False,bIsEditorOnly=True,Directories=((Path="/Game/Maps")),SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=Unknown))
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:43, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
(PrimaryAssetType="PrimaryAssetLabel",AssetBaseClass=/Script/Engine.PrimaryAssetLabel,bHasBlueprintClasses=False,bIsEditorOnly=True,Directories=((Path="/Game")),SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=Unknown))
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:44, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
(PrimaryAssetType="Map",AssetBaseClass="/Script/Engine.World",bHasBlueprintClasses=False,bIsEditorOnly=False,Directories=((Path="/Game/Maps")),SpecificAssets=("/Game/System/FrontEnd/Maps/L_LyraFrontEnd.L_LyraFrontEnd", "/Game/System/DefaultEditorMap/L_DefaultEditorOverview.L_DefaultEditorOverview"),Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=AlwaysCook))
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:45, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
(PrimaryAssetType="LyraGameData",AssetBaseClass="/Script/LyraGame.LyraGameData",bHasBlueprintClasses=False,bIsEditorOnly=False,Directories=,SpecificAssets=("/Game/DefaultGameData.DefaultGameData"),Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=AlwaysCook))
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:46, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
(PrimaryAssetType="PrimaryAssetLabel",AssetBaseClass="/Script/Engine.PrimaryAssetLabel",bHasBlueprintClasses=False,bIsEditorOnly=True,Directories=((Path="/Game")),SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=Unknown))
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:47, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
(PrimaryAssetType="GameFeatureData",AssetBaseClass="/Script/GameFeatures.GameFeatureData",bHasBlueprintClasses=False,bIsEditorOnly=False,Directories=((Path="/Game/Unused")),SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=AlwaysCook))
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:48, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
(PrimaryAssetType="LyraExperienceDefinition",AssetBaseClass="/Script/LyraGame.LyraExperienceDefinition",bHasBlueprintClasses=True,bIsEditorOnly=False,Directories=((Path="/Game/System/Experiences")),SpecificAssets=("/Game/System/FrontEnd/B_LyraFrontEnd_Experience.B_LyraFrontEnd_Experience"),Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=AlwaysCook))
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:49, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
(PrimaryAssetType="LyraUserFacingExperienceDefinition",AssetBaseClass="/Script/LyraGame.LyraUserFacingExperienceDefinition",bHasBlueprintClasses=False,bIsEditorOnly=False,Directories=((Path="/Game/UI/Temp"),(Path="/Game/System/Playlists")),SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=AlwaysCook))
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:50, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
(PrimaryAssetType="LyraLobbyBackground",AssetBaseClass="/Script/LyraGame.LyraLobbyBackground",bHasBlueprintClasses=False,bIsEditorOnly=False,Directories=,SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=AlwaysCook))
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:51, section: [/Script/Engine.AssetManagerSettings]
- INI Section:
/Script/Engine.AssetManagerSettings
- Raw value:
(PrimaryAssetType="LyraExperienceActionSet",AssetBaseClass="/Script/LyraGame.LyraExperienceActionSet",bHasBlueprintClasses=False,bIsEditorOnly=False,Directories=,SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=AlwaysCook))
- Is Array:
True
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Private/GameFeaturesSubsystem.cpp:561
Scope (from outer to inner):
file
function void UGameFeaturesSubsystem::AddGameFeatureToAssetManager
Source code excerpt:
// If we did not previously scan anything for a primary asset type that is in our config, try to reuse the cook rules from the config instead of the one in the gamefeaturedata, which should not be modifying cook rules
const FPrimaryAssetTypeInfo* ConfigTypeInfo = LocalAssetManager.GetSettings().PrimaryAssetTypesToScan.FindByPredicate([&TypeInfo](const FPrimaryAssetTypeInfo& PATI) -> bool { return PATI.PrimaryAssetType == TypeInfo.PrimaryAssetType; });
if (ConfigTypeInfo)
{
LocalAssetManager.SetPrimaryAssetTypeRules(TypeInfo.PrimaryAssetType, ConfigTypeInfo->Rules);
}
else
{
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Public/GameFeatureData.h:21
Scope (from outer to inner):
file
class class UGameFeatureData : public UPrimaryDataAsset
function virtual const TArray<FPrimaryAssetTypeInfo>& GetPrimaryAssetTypesToScan
Source code excerpt:
public:
/** Method to get where the primary assets should scanned from in the plugin hierarchy */
virtual const TArray<FPrimaryAssetTypeInfo>& GetPrimaryAssetTypesToScan() const { return PrimaryAssetTypesToScan; }
#if WITH_EDITOR
virtual TArray<FPrimaryAssetTypeInfo>& GetPrimaryAssetTypesToScan() { return PrimaryAssetTypesToScan; }
virtual void GetAssetRegistryTags(FAssetRegistryTagsContext Context) const override;
static void GetDependencyDirectoriesFromAssetData(const FAssetData& AssetData, TArray<FString>& OutDependencyDirectories);
//~Begin deprecation
UE_DEPRECATED(5.4, "Implement the version that takes FAssetRegistryTagsContext instead.")
virtual void GetAssetRegistryTags(TArray<FAssetRegistryTag>& OutTags) const override;
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Public/GameFeatureData.h:101
Scope (from outer to inner):
file
class class UGameFeatureData : public UPrimaryDataAsset
Source code excerpt:
/** List of asset types to scan at startup */
UPROPERTY(EditAnywhere, Category="Game Feature | Asset Manager", meta=(TitleProperty="PrimaryAssetType"))
TArray<FPrimaryAssetTypeInfo> PrimaryAssetTypesToScan;
};
#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_2
#include "CoreMinimal.h"
#include "Engine/AssetManagerTypes.h"
#endif
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeaturesEditor/Private/GameFeaturesEditorModule.cpp:350
Scope (from outer to inner):
file
class class FGameFeaturesEditorModule : public FDefaultModuleImpl
function void AddDefaultGameDataRule
Source code excerpt:
Settings->Modify(true);
Settings->PrimaryAssetTypesToScan.Add(NewTypeInfo);
Settings->PostEditChange();
Settings->TryUpdateDefaultConfigFile();
UAssetManager::Get().ReinitializeFromConfig();
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/AssetManagerSettings.h:78
Scope (from outer to inner):
file
class class UAssetManagerSettings : public UDeveloperSettings
Source code excerpt:
/** List of asset types to scan at startup */
UPROPERTY(config, EditAnywhere, Category = "Asset Manager", meta = (TitleProperty = "PrimaryAssetType"))
TArray<FPrimaryAssetTypeInfo> PrimaryAssetTypesToScan;
/** List of directories to exclude from scanning for Primary Assets, useful to exclude test assets */
UPROPERTY(config, EditAnywhere, Category = "Asset Manager", meta = (RelativeToGameContentDir, LongPackageName))
TArray<FDirectoryPath> DirectoriesToExclude;
/** List of specific asset rule overrides */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetManager.cpp:3325
Scope (from outer to inner):
file
function void UAssetManager::ScanPrimaryAssetTypesFromConfig
Source code excerpt:
double LastPumpTime = FPlatformTime::Seconds();
for (FPrimaryAssetTypeInfo TypeInfo : Settings.PrimaryAssetTypesToScan)
{
// This function also fills out runtime data on the copy
if (!ShouldScanPrimaryAssetType(TypeInfo))
{
continue;
}