LocalMapOptions

LocalMapOptions

#Overview

name: LocalMapOptions

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of LocalMapOptions is to provide additional options or parameters that are appended to the default map when it is loaded in Unreal Engine 5. This setting variable is primarily used for configuring default map loading behavior.

LocalMapOptions is primarily used by the Engine and GameInstance subsystems of Unreal Engine 5. It’s referenced in the GameInstance and UnrealEngine modules, which are core components of the engine responsible for managing game sessions and overall engine functionality.

The value of this variable is set in the GameMapsSettings class, which is defined in the EngineSettings module. It’s declared as a config property, meaning its value can be set in configuration files (like DefaultEngine.ini) and can be edited in the project settings within the Unreal Editor.

LocalMapOptions interacts closely with other map-related variables, particularly GetGameDefaultMap(). These two are often concatenated to form the complete map reference when loading maps.

Developers should be aware that LocalMapOptions is appended directly to the default map name without any separator. If you need to pass specific options or parameters, you should ensure they’re in the correct format (typically starting with a ? for URL parameters).

Best practices when using this variable include:

  1. Use it to set global options that should apply to all map loads by default.
  2. Ensure any options set here are compatible with all maps in your project.
  3. Be cautious about setting options that might interfere with specific map designs or gameplay mechanics.
  4. Document any use of LocalMapOptions clearly for other team members, as its effects are global and might not be immediately obvious when debugging map-related issues.
  5. Consider using it for development or testing purposes, but be prepared to clear it for production builds if the options are not universally applicable.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:18, section: [/Script/EngineSettings.GameMapsSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameInstance.cpp:646

Scope (from outer to inner):

file
function     void UGameInstance::StartGameInstance

Source code excerpt:

	if (!GetMapOverrideName(Tmp, PackageName))
	{
		PackageName = DefaultMap + GameMapsSettings->LocalMapOptions;
	}

	FURL URL(&DefaultURL, *PackageName, TRAVEL_Partial);
	if (URL.Valid)
	{
		BrowseRet = Engine->Browse(*WorldContext, URL, Error);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameInstance.cpp:673

Scope (from outer to inner):

file
function     void UGameInstance::StartGameInstance

Source code excerpt:

			else
			{
				BrowseRet = Engine->Browse(*WorldContext, FURL(&DefaultURL, *(DefaultMap + GameMapsSettings->LocalMapOptions), TRAVEL_Partial), Error);
			}
		}
		else
		{
			const FText Message = FText::Format(NSLOCTEXT("Engine", "MapNotFoundNoFallback", "The map specified on the commandline '{0}' could not be found. Exiting."), FText::FromString(URL.Map));
			FMessageDialog::Open(EAppMsgType::Ok, Message);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:12993

Scope (from outer to inner):

file
function     FString appGetStartupMap

Source code excerpt:

	{
		const UGameMapsSettings* GameMapsSettings = GetDefault<UGameMapsSettings>();
		FCString::Strcpy(Parm, *(GameMapsSettings->GetGameDefaultMap() + GameMapsSettings->LocalMapOptions));
	}
	FURL URL(&DefaultURL, Parm, TRAVEL_Partial);

	// strip off extension of the map if there is one
	return FPaths::GetBaseFilename(URL.Map);
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:14431

Scope: file

Source code excerpt:

					if (GameMapsSettings)
					{
						PotentialWorldContext.TravelURL = FURL(&DefaultURL, *(GameMapsSettings->GetGameDefaultMap() + GameMapsSettings->LocalMapOptions), TRAVEL_Partial).ToString();
						PotentialWorldContext.TravelType = TRAVEL_Partial;
					}
				}
			}
		}
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:14630

Scope (from outer to inner):

file
function     EBrowseReturnVal::Type UEngine::Browse

Source code excerpt:

		
		const UGameMapsSettings* GameMapsSettings = GetDefault<UGameMapsSettings>();
		const FURL DefaultURL = FURL(&URL, *(GameMapsSettings->GetGameDefaultMap() + GameMapsSettings->LocalMapOptions), TRAVEL_Partial);

		if (!LoadMap(WorldContext, DefaultURL, NULL, Error))
		{
			HandleBrowseToDefaultMapFailure(WorldContext, DefaultURL.ToString(), Error);
			return EBrowseReturnVal::Failure;
		}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:14779

Scope (from outer to inner):

file
function     void UEngine::BrowseToDefaultMap

Source code excerpt:

	DefaultURL.LoadURLConfig( TEXT("DefaultPlayer"), GGameIni );
	const UGameMapsSettings* GameMapsSettings = GetDefault<UGameMapsSettings>();
	const FString& TextURL = GameMapsSettings->GetGameDefaultMap() + GameMapsSettings->LocalMapOptions;

	if (Browse( Context, FURL(&DefaultURL, *TextURL, TRAVEL_Partial), Error ) != EBrowseReturnVal::Success)
	{
		HandleBrowseToDefaultMapFailure(Context, TextURL, Error);
	}
}

#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Classes/GameMapsSettings.h:158

Scope (from outer to inner):

file
class        class UGameMapsSettings : public UObject

Source code excerpt:

	/** The default options that will be appended to a map being loaded. */
	UPROPERTY(config, EditAnywhere, Category=DefaultMaps, AdvancedDisplay)
	FString LocalMapOptions;

	/** The map loaded when transition from one map to another. */
	UPROPERTY(config, EditAnywhere, Category=DefaultMaps, AdvancedDisplay, meta=(AllowedClasses="/Script/Engine.World"))
	FSoftObjectPath TransitionMap;

	/** Whether the screen should be split or not when multiple local players are present */