AGameModeBase::OptionsString
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: UPROPERTYBlueprintReadOnly
Description
Stores the full URL options string from the map load command. Parse individual key-value pairs from it using UGameplayStatics::ParseOption() or HasOption().
Caveats & Gotchas
- • Set during InitGame() and unchanged for the lifetime of the map. Server travel to a new map with different options produces a new OptionsString on the new GameMode instance — the old value is not inherited.
- • Options are plain text from the connection URL and are not sanitized. Never pass raw option values to file paths, shell commands, or database queries — always validate or whitelist the values first.
Signature
UPROPERTY(BlueprintReadOnly, Category=GameMode)
FString OptionsString; Example
Read a custom difficulty option from the launch URL C++
void AMyGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
{
Super::InitGame(MapName, Options, ErrorMessage);
// OptionsString is now set
FString DifficultyStr = UGameplayStatics::ParseOption(OptionsString, TEXT("Difficulty"));
Difficulty = DifficultyStr.IsEmpty() ? EGameDifficulty::Normal : ParseDifficulty(DifficultyStr);
} Tags
Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?