RealDocs

UGameplayStatics::HasLaunchOption

function Engine Blueprint Since 4.0
#include "Kismet/GameplayStatics.h"
Access: public Specifiers: staticBlueprintPure

Description

Returns true if a specific option was passed on the process command line at launch (e.g. -demobuild). Useful for toggling developer or QA features without shipping separate builds.

Caveats & Gotchas

  • The search wraps FCommandLine::Get() which returns the raw process command-line string; the option must match exactly (case-insensitive) and be prefixed with '-' in the actual command line, but you pass the name without the '-' to this function.
  • This reads the global command line at call time, not at startup — it is safe to call at any point but the string never changes after process launch, so caching the result is fine and avoids repeated string searches in hot paths.

Signature

static ENGINE_API bool HasLaunchOption(const FString& OptionToCheck);

Parameters

Name Type Description Default
OptionToCheck const FString& The command-line option name to search for, without the leading '-'.

Return Type

bool

Example

Enable a dev cheat mode via command-line flag C++
if (UGameplayStatics::HasLaunchOption(TEXT("EnableCheats")))
{
    SetCheatManager(NewObject<UMyCheatManager>(this));
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.