GameDefaultMap
GameDefaultMap
#Overview
name: GameDefaultMap
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 GameDefaultMap is to specify the default map that will be loaded when no other map is specified in Unreal Engine 5. This setting is crucial for defining the initial gameplay environment when launching a game.
GameDefaultMap is primarily used by the Engine Settings and Game Project Generation subsystems of Unreal Engine 5. It’s referenced in the EngineSettings module and the GameProjectGeneration module.
The value of this variable is typically set in the project’s configuration files, specifically in the DefaultEngine.ini file under the [/Script/EngineSettings.GameMapsSettings] section. It can also be set programmatically using the SetGameDefaultMap function in the UGameMapsSettings class.
GameDefaultMap interacts with other variables such as ServerDefaultMap (used for dedicated servers) and EditorStartupMap (used in the editor environment). The engine chooses between GameDefaultMap and ServerDefaultMap based on whether the game is running as a dedicated server or not.
Developers should be aware that:
- This variable expects a valid map reference.
- It’s used both in packaged games and in development environments.
- Changes to this variable may require a reload of the configuration or a restart of the engine to take effect.
Best practices when using this variable include:
- Always ensure the referenced map exists in the project to avoid startup errors.
- Use the SetGameDefaultMap function to change this value at runtime if needed, rather than directly modifying the property.
- Consider setting different maps for GameDefaultMap and ServerDefaultMap if your game has distinct client and server experiences.
- Regularly verify this setting, especially after major project changes or when preparing for deployment.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:12, section: [/Script/EngineSettings.GameMapsSettings]
- INI Section:
/Script/EngineSettings.GameMapsSettings
- Raw value:
/Engine/Maps/Templates/OpenWorld
- Is Array:
False
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:68, section: [/Script/EngineSettings.GameMapsSettings]
- INI Section:
/Script/EngineSettings.GameMapsSettings
- Raw value:
/Game/System/FrontEnd/Maps/L_LyraFrontEnd.L_LyraFrontEnd
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/GameProjectGeneration/Private/GameProjectUtils.cpp:197
Scope (from outer to inner):
file
namespace anonymous
function void AddDefaultMapConfigValues
Source code excerpt:
ConfigValues.Emplace(TEXT("DefaultEngine.ini"),
TEXT("/Script/EngineSettings.GameMapsSettings"),
TEXT("GameDefaultMap"),
DefaultMap,
true /* ShouldReplaceExistingValue */);
}
}
/** Get the configuration values for enabling WorldPartition by default. */
void AddWorldPartitionConfigValues(const FProjectInformation& InProjectInfo, TArray<FTemplateConfigValue>& ConfigValues)
{
if (InProjectInfo.bIsBlankTemplate)
{
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/CookOnTheFlyServer.cpp:9332
Scope (from outer to inner):
file
function void UCookOnTheFlyServer::GetGameDefaultObjects
Source code excerpt:
// get the server and game default maps/modes and cook them
AddDefaultObject(FName(TEXT("GameDefaultMap")));
AddDefaultObject(FName(TEXT("ServerDefaultMap")));
AddDefaultObject(FName(TEXT("GlobalDefaultGameMode")));
AddDefaultObject(FName(TEXT("GlobalDefaultServerGameMode")));
AddDefaultObject(FName(TEXT("GameInstanceClass")));
}
}
#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Classes/GameMapsSettings.h:128
Scope (from outer to inner):
file
class class UGameMapsSettings : public UObject
Source code excerpt:
/**
* Set the default map to use (see GameDefaultMap below)
*
* @param NewMap name of valid map to use
*/
static ENGINESETTINGS_API void SetGameDefaultMap( const FString& NewMap );
/**
* Set the default game type (see GlobalDefaultGameMode below)
*
* @param NewGameMode name of valid map to use
*/
#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Classes/GameMapsSettings.h:195
Scope (from outer to inner):
file
class class UGameMapsSettings : public UObject
Source code excerpt:
/** The map that will be loaded by default when no other map is loaded. */
UPROPERTY(config, EditAnywhere, Category=DefaultMaps, meta=(AllowedClasses="/Script/Engine.World"))
FSoftObjectPath GameDefaultMap;
/** The map that will be loaded by default when no other map is loaded (DEDICATED SERVER). */
UPROPERTY(config, EditAnywhere, Category=DefaultMaps, AdvancedDisplay, meta=(AllowedClasses="/Script/Engine.World"))
FSoftObjectPath ServerDefaultMap;
/** GameMode to use if not specified in any other way. (e.g. per-map DefaultGameMode or on the URL). */
#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Private/EngineSettingsModule.cpp:90
Scope (from outer to inner):
file
function FString UGameMapsSettings::GetGameDefaultMap
Source code excerpt:
return IsRunningDedicatedServer()
? GetDefault<UGameMapsSettings>()->ServerDefaultMap.GetLongPackageName()
: GetDefault<UGameMapsSettings>()->GameDefaultMap.GetLongPackageName();
}
FString UGameMapsSettings::GetGlobalDefaultGameMode( )
{
UGameMapsSettings* GameMapsSettings = Cast<UGameMapsSettings>(UGameMapsSettings::StaticClass()->GetDefaultObject());
#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Private/EngineSettingsModule.cpp:200
Scope (from outer to inner):
file
function void UGameMapsSettings::SetGameDefaultMap
Source code excerpt:
else
{
GameMapsSettings->GameDefaultMap = NewMap;
}
}
void UGameMapsSettings::SetGlobalDefaultGameMode( const FString& NewGameMode )
{
UGameMapsSettings* GameMapsSettings = Cast<UGameMapsSettings>(UGameMapsSettings::StaticClass()->GetDefaultObject());
#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Private/EngineSettingsModule.cpp:246
Scope (from outer to inner):
file
function void UGameMapsSettings::PostInitProperties
Source code excerpt:
FixMapAssetRef(EditorStartupMap);
#endif
FixMapAssetRef(GameDefaultMap);
FixMapAssetRef(ServerDefaultMap);
FixMapAssetRef(TransitionMap);
}
void UGameMapsSettings::PostReloadConfig( FProperty* PropertyThatWasLoaded )
{
#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Private/EngineSettingsModule.cpp:262
Scope (from outer to inner):
file
function void UGameMapsSettings::PostReloadConfig
Source code excerpt:
else
#endif
if (PropertyThatWasLoaded->GetFName() == GET_MEMBER_NAME_CHECKED(UGameMapsSettings, GameDefaultMap))
{
FixMapAssetRef(GameDefaultMap);
}
else if (PropertyThatWasLoaded->GetFName() == GET_MEMBER_NAME_CHECKED(UGameMapsSettings, ServerDefaultMap))
{
FixMapAssetRef(ServerDefaultMap);
}
else if (PropertyThatWasLoaded->GetFName() == GET_MEMBER_NAME_CHECKED(UGameMapsSettings, TransitionMap))
#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Private/EngineSettingsModule.cpp:280
Scope (from outer to inner):
file
function void UGameMapsSettings::PostReloadConfig
Source code excerpt:
FixMapAssetRef(EditorStartupMap);
#endif
FixMapAssetRef(GameDefaultMap);
FixMapAssetRef(ServerDefaultMap);
FixMapAssetRef(TransitionMap);
}
}