TemplateMapInfos
TemplateMapInfos
#Overview
name: TemplateMapInfos
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 9
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of TemplateMapInfos is to store a list of information about available Level Instance template maps in Unreal Engine 5. This variable is used primarily in the Level Instance and level creation systems.
TemplateMapInfos is utilized by the following Unreal Engine subsystems and modules:
- LevelInstanceEditor module
- NewLevelDialog module
- UnrealEd module
The value of this variable is set in the ULevelInstanceEditorSettings class, which is derived from UDeveloperSettings. It is configured as a UPROPERTY with the ‘config’ specifier, meaning its value can be saved and loaded from configuration files.
TemplateMapInfos interacts with other variables and systems:
- It’s used in conjunction with the bEnableStreaming variable in the LevelInstanceEditorSettings.
- It’s used to populate the template selection dialog when creating new Level Instances.
- It’s part of the UUnrealEdEngine class, which is central to the Unreal Editor’s functionality.
Developers should be aware of the following when using this variable:
- The variable can be overridden at runtime using the OnGetTemplateMapInfos delegate in UUnrealEdEngine.
- There’s a cache version (TemplateMapInfoCache) used by the editor to avoid saving transient changes.
- The AppendTemplateMaps function can be used to add new template maps, but it checks for duplicates to avoid registering the same template multiple times.
Best practices when using this variable include:
- Ensure that template maps are properly configured and tested before adding them to the TemplateMapInfos array.
- Use the provided functions (like AppendTemplateMaps) to modify the list rather than directly manipulating the array.
- Be mindful of the interaction between this variable and the level streaming system, especially when the bEnableStreaming flag is involved.
- When creating custom editor modules that interact with Level Instances, consider using the GetTemplateMapInfos() function from UUnrealEdEngine to access the most up-to-date list of templates.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:1839, section: [/Script/UnrealEd.UnrealEdEngine]
- INI Section:
/Script/UnrealEd.UnrealEdEngine
- Raw value:
(Thumbnail="/Engine/Maps/Templates/Thumbnails/OpenWorld.OpenWorld",Map="/Engine/Maps/Templates/OpenWorld",DisplayName="Open World",Category="OpenWorld")
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:1840, section: [/Script/UnrealEd.UnrealEdEngine]
- INI Section:
/Script/UnrealEd.UnrealEdEngine
- Raw value:
(Thumbnail="/Engine/Maps/Templates/Thumbnails/Basic.Basic",Map="/Engine/Maps/Templates/Template_Default",DisplayName="Basic")
- Is Array:
True
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/LevelInstanceEditor/Private/LevelInstanceEditorModule.cpp:352
Scope (from outer to inner):
file
namespace LevelInstanceMenuUtils
function void CreateLevelInstanceFromSelection
Source code excerpt:
const bool bShowPartitionedTemplates = false;
ULevelInstanceEditorSettings* LevelInstanceEditorSettings = GetMutableDefault<ULevelInstanceEditorSettings>();
if (!LevelInstanceEditorSettings->TemplateMapInfos.Num() || NewLevelDialogModule.CreateAndShowTemplateDialog(MainFrameModule.GetParentWindow(), LOCTEXT("LevelInstanceTemplateDialog", "Choose Level Instance Template..."), GetMutableDefault<ULevelInstanceEditorSettings>()->TemplateMapInfos, TemplateMapPackage, bShowPartitionedTemplates, bOutIsPartitionedWorld))
{
UPackage* TemplatePackage = !TemplateMapPackage.IsEmpty() ? LoadPackage(nullptr, *TemplateMapPackage, LOAD_None) : nullptr;
CreationParams.TemplateWorld = TemplatePackage ? UWorld::FindWorldInPackage(TemplatePackage) : nullptr;
CreationParams.LevelInstanceClass = GetDefaultLevelInstanceClass(CreationType);
CreationParams.bEnableStreaming = LevelInstanceEditorSettings->bEnableStreaming;
#Loc: <Workspace>/Engine/Source/Editor/LevelInstanceEditor/Public/LevelInstanceEditorSettings.h:20
Scope (from outer to inner):
file
class class ULevelInstanceEditorSettings : public UDeveloperSettings
Source code excerpt:
/** List of info for all known LevelInstance template maps */
UPROPERTY(config)
TArray<FTemplateMapInfo> TemplateMapInfos;
UPROPERTY(config)
FString LevelInstanceClassName;
UPROPERTY(config, EditAnywhere, Category="World Partition", meta = (ToolTip="Create World Partition Level Instances with Streaming Enabled/Disabled by default"))
bool bEnableStreaming;
#Loc: <Workspace>/Engine/Source/Editor/NewLevelDialog/Private/NewLevelDialogModule.cpp:352
Scope (from outer to inner):
file
class class SNewLevelDialog : public SCompoundWidget, public FGCObject
function static TArray<TSharedPtr<FNewLevelTemplateItem>> MakeTemplateItems
Source code excerpt:
private:
static TArray<TSharedPtr<FNewLevelTemplateItem>> MakeTemplateItems(bool bShowPartitionedTemplates, FNewLevelDialogModule::EShowEmptyTemplate ShowEmptyTemplate, const TArray<FTemplateMapInfo>& TemplateMapInfos)
{
TArray<TSharedPtr<FNewLevelTemplateItem>> TemplateItems;
// Build a list of items - one for each template
int32 CurrentIndex = 0;
for (const FTemplateMapInfo& TemplateMapInfo : TemplateMapInfos)
{
if (!bShowPartitionedTemplates && ULevel::GetIsLevelPartitionedFromPackage(FName(*TemplateMapInfo.Map.ToString())))
{
CurrentIndex++;
continue;
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Editor/UnrealEdEngine.h:134
Scope (from outer to inner):
file
class class UUnrealEdEngine : public UEditorEngine, public FNotifyHook
Source code excerpt:
/** List of info for all known template maps */
UPROPERTY(config)
TArray<FTemplateMapInfo> TemplateMapInfos;
/** Cooker server incase we want to cook on the side while editing... */
UPROPERTY()
TObjectPtr<class UCookOnTheFlyServer> CookServer;
/** When deleting actors, these types should not generate warnings when references will be broken (this should only be types that don't affect gameplay) */
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Editor/UnrealEdEngine.h:735
Scope (from outer to inner):
file
class class UUnrealEdEngine : public UEditorEngine, public FNotifyHook
Source code excerpt:
* Appends the specified template maps to the list of available templates.
*/
UNREALED_API void AppendTemplateMaps( const TArray<FTemplateMapInfo>& TemplateMapInfos );
/**
* Returns true if the user is currently interacting with a viewport.
*/
UNREALED_API bool IsUserInteracting();
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Editor/UnrealEdEngine.h:861
Scope: file
Source code excerpt:
UNREALED_API bool HasMountWritePermissionForPackage(const FString& PackageName);
/* Delegate to override TemplateMapInfos */
DECLARE_DELEGATE_RetVal(const TArray<FTemplateMapInfo>&, FGetTemplateMapInfos);
FGetTemplateMapInfos& OnGetTemplateMapInfos() { return GetTemplateMapInfosDelegate; }
/** Gets the canonical list of map templates that should be visible in new level picker. This function calls OnGetTemplateMapInfos to allow runtime override of the default maps */
UNREALED_API const TArray<FTemplateMapInfo>& GetTemplateMapInfos() const;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Editor/UnrealEdEngine.h:920
Scope: file
Source code excerpt:
TWeakPtr<SNotificationItem> WritePermissionWarningNotificationWeakPtr;
/* Delegate to override TemplateMapInfos */
FGetTemplateMapInfos GetTemplateMapInfosDelegate;
/** Transient unsaved version of template map infos used by the editor. */
TArray<FTemplateMapInfo> TemplateMapInfoCache;
/** Proxy for a cotf server running in a separate process */
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/UnrealEdEngine.cpp:1048
Scope (from outer to inner):
file
function void UUnrealEdEngine::RebuildTemplateMapData
Source code excerpt:
{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
TemplateMapInfoCache = TemplateMapInfos;
PRAGMA_ENABLE_DEPRECATION_WARNINGS
}
}
void UUnrealEdEngine::AppendTemplateMaps(const TArray<FTemplateMapInfo>& InTemplateMapInfos)
{
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/UnrealEdEngine.cpp:1060
Scope (from outer to inner):
file
function void UUnrealEdEngine::AppendTemplateMaps
Source code excerpt:
for (const FTemplateMapInfo& TemplateMapInfo : InTemplateMapInfos)
{
if (!TemplateMapInfos.ContainsByPredicate(
[&TemplateMapInfo](const FTemplateMapInfo& InTemplate)
{
return InTemplate.Map == TemplateMapInfo.Map
&& InTemplate.DisplayName.EqualTo(InTemplate.DisplayName);
}))
{
TemplateMapInfos.Emplace(TemplateMapInfo);
bTemplateWasAdded = true;
}
else
{
UE_LOG(LogUnrealEdEngine, Warning, TEXT("Attempted to register an already registered template map ('%s'). Skipping registration."), *TemplateMapInfo.Map.ToString());
}