Made For Unreal — Docs
Blueprint CheatsAPI ReferenceC++ API

Cheat Arguments (C++)

C++ surface of cheat argument types — base class, concrete subclasses, templated accessors, and authoring patterns.

Cheat arguments are the typed inputs a cheat declares in NamedExpectedArguments. This page covers the C++ surface — class declarations, properties, virtuals, and templated accessors.

  • Header: Source/BlueprintCheats/Public/BlueprintCheatArgument.h
  • Module: BlueprintCheats (Runtime)

EBlueprintCheatArgumentType

UENUM(BlueprintType)
enum class EBlueprintCheatArgumentType : uint8
{
    Undefined,
    Boolean,
    Double,
    Float,
    Enum,
    Int,
    String
};

UBlueprintCheatArgument (base)

UCLASS(Abstract, BlueprintType, Transient, CollapseCategories)
class UBlueprintCheatArgument : public UObject;

Abstract base for every argument type.

Properties (protected)

FName ArgumentName = NAME_None;

UPROPERTY(EditDefaultsOnly) FText DisplayName;
UPROPERTY(EditDefaultsOnly) int32 Position  = 0;
UPROPERTY(EditDefaultsOnly) bool  bOptional = false;

FVariant InternalDefaultValue;
FVariant InternalValue;
PropertyNotes
ArgumentNameSet internally to the map key from NamedExpectedArguments.
DisplayNameLabel shown in the menu and used in error text. Falls back to ArgumentName when empty.
Position0-based positional index. Drives console parsing and menu sort.
bOptionalWhen true, parsing succeeds without this token.
InternalDefaultValueThe configured default (set by each subclass's Refresh).
InternalValueThe current runtime value.

These are protected, so external code typically configures them via a subclass that exposes them, or by authoring the cheat as a Blueprint subclass of a C++ base. See Authoring patterns below.

Virtuals

virtual bool ParseString(const FString& StringValue);                       // pure virtual
virtual bool UseDefault();                                                  // pure virtual
virtual bool HasValue() const;
virtual FText GetDisplayName() const;
virtual bool IsValid(TArray<FText>& ValidationMessages) const;
virtual EBlueprintCheatArgumentType GetType() const;
virtual FString GetValueAsString() const;                                   // pure virtual

// Editor-only:
virtual void PostLoad() override;
virtual void PostInitProperties() override;
virtual void PostEditChangeProperty(struct FPropertyChangedEvent&) override;
virtual void Refresh();                                                     // editor-only
FunctionPurpose
ParseString(FString)Convert a console token to the typed value. Return false on parse / range failure.
UseDefault()Apply the configured default. Return false when no default is configured.
HasValue() constWhether InternalValue currently holds a value.
GetType() constReturns the argument's EBlueprintCheatArgumentType.
GetValueAsString() constStringified current value — used by some widgets and logging.
IsValid(OutMessages) constValidates the configured argument (e.g. min ≤ max, default in range). Used by editor data validation.
IsOptional() constMirrors bOptional.
GetPosition() constMirrors Position.
ResetValue()Clears InternalValue back to "no value".

Templated accessors

template<typename T> T    GetValue() const;          // reads InternalValue
template<typename T> T    GetDefaultValue() const;   // reads InternalDefaultValue
template<typename T> void SetValue(T ValueIn);       // writes InternalValue

There is no runtime safety net — call GetType() and HasValue() before calling GetValue<T>(). Calling GetValue<int32>() on a float argument is undefined behavior.

Concrete subclasses

All subclasses are UCLASS(BlueprintType, EditInlineNew, CollapseCategories). Their configuration fields are protected UPROPERTY(EditDefaultsOnly).

UBlueprintCheatBoolArgument

UPROPERTY(EditDefaultsOnly) TOptional<bool> DefaultValue;

ParseString accepts true/false, 1/0, yes/no.

UBlueprintCheatStringArgument

UPROPERTY(EditDefaultsOnly) TOptional<FString> DefaultValue;
UPROPERTY(EditDefaultsOnly) int32 MinStringLength = 0;
UPROPERTY(EditDefaultsOnly) int32 MaxStringLength = 9999;

void GetMinMaxLength(int32& MinLengthOut, int32& MaxLengthOut) const;

UBlueprintCheatIntArgument

UPROPERTY(EditDefaultsOnly) TOptional<int32> DefaultValue;
UPROPERTY(EditDefaultsOnly) TOptional<int32> MinValue;
UPROPERTY(EditDefaultsOnly) TOptional<int32> MaxValue;

void GetMinMaxValues(int32& MinValue, int32& MaxValue) const;

UBlueprintCheatFloatArgument

UPROPERTY(EditDefaultsOnly) TOptional<float> DefaultValue;
UPROPERTY(EditDefaultsOnly) TOptional<float> MinValue;
UPROPERTY(EditDefaultsOnly) TOptional<float> MaxValue;

void GetMinMaxValues(float& MinValue, float& MaxValue) const;

UBlueprintCheatDoubleArgument

UPROPERTY(EditDefaultsOnly) TOptional<double> DefaultValue;
UPROPERTY(EditDefaultsOnly) TOptional<double> MinValue;
UPROPERTY(EditDefaultsOnly) TOptional<double> MaxValue;

void GetMinMaxValues(double& MinValue, double& MaxValue) const;

UBlueprintCheatEnumArgument

UPROPERTY(EditDefaultsOnly) FTopLevelAssetPath EnumTypePath;
UPROPERTY(EditDefaultsOnly) int32 DefaultValue = INDEX_NONE;

UEnum* GetExpectedEnumObject() const;
static FName GetDefaultValuePropName();
static FName GetEnumTypePathPropName();

ParseString accepts the entry's display name or its raw name.

Reading values

Two ways to read values from TMap<FName, UBlueprintCheatArgument*>:

Direct (templated)

const TMap<FName, UBlueprintCheatArgument*>& Args = GetExpectedArguments();

if (UBlueprintCheatArgument* const* AmountArgPtr = Args.Find(TEXT("Amount")))
{
    UBlueprintCheatArgument* AmountArg = *AmountArgPtr;
    if (AmountArg && AmountArg->GetType() == EBlueprintCheatArgumentType::Float
        && AmountArg->HasValue())
    {
        const float Amount = AmountArg->GetValue<float>();
        // ...
    }
}

Via the function library

#include "BlueprintCheatArgumentLibrary.h"

float Amount = 0.f;
if (!UBlueprintCheatArgumentLibrary::GetCheatArgumentAsFloat(
        Args.FindRef(TEXT("Amount")), Amount))
{
    OutcomeMessage = INVTEXT("Amount missing or wrong type");
    return false;
}

The library performs the type-and-HasValue check for you and returns a bool for success. See Function Libraries for the full list.

Authoring patterns

The argument subclasses' configuration fields (DefaultValue, MinValue, MaxValue, bOptional, Position) are protected. Two patterns work in C++:

Declare the cheat in C++ but add the entries to NamedExpectedArguments from a Blueprint subclass:

UCLASS(Abstract)
class MYGAME_API UMyCheat_DamageBase : public UBlueprintCheatScript
{
    GENERATED_BODY()

public:
    static const FName ArgAmount;
    static const FName ArgTarget;

protected:
    virtual bool Execute(APlayerController* Controller, FText& OutcomeMessage) const override;
};
const FName UMyCheat_DamageBase::ArgAmount = TEXT("Amount");
const FName UMyCheat_DamageBase::ArgTarget = TEXT("Target");

Then make BPCheat_Damage a Blueprint subclass of UMyCheat_DamageBase, and add the Amount / Target entries via the Named Expected Arguments map in the Class Defaults. This keeps the field visibility rules intact while giving you compile-time argument keys and C++ logic.

2. Custom argument subclasses with friend access

If you want a fully code-only cheat, derive your own argument subclass that exposes the configuration:

UCLASS()
class MYGAME_API UMyFloatArg : public UBlueprintCheatFloatArgument
{
    GENERATED_BODY()

public:
    void Configure(int32 InPosition, bool bInOptional,
                   TOptional<float> InDefault,
                   TOptional<float> InMin, TOptional<float> InMax)
    {
        Position     = InPosition;
        bOptional    = bInOptional;
        DefaultValue = InDefault;
        MinValue     = InMin;
        MaxValue     = InMax;
    }
};

A subclass can read its base's protected members, so this works without explicit friend. Then in your cheat constructor:

UMyCheat_Damage::UMyCheat_Damage()
{
    UMyFloatArg* Amount = NewObject<UMyFloatArg>(this);
    Amount->Configure(/*Position*/ 0, /*Optional*/ false,
                      /*Default*/ 1.f, /*Min*/ 0.f, /*Max*/ 1000.f);
    NamedExpectedArguments.Add(TEXT("Amount"), Amount);
}

Console parsing example

The default TryToParseStringArguments walks NamedExpectedArguments sorted by Position, applies defaults / optionals, and calls ParseString on each matching token. Given:

Position 0 : Multiplier  (float, default 1.0)
Position 1 : Duration    (float, optional)
Console inputResult
cheatMultiplier = 1.0 (default), Duration not set.
cheat 2.5Multiplier = 2.5, Duration not set.
cheat 2.5 10Multiplier = 2.5, Duration = 10.
cheat fooParse failure; outcome message names the offending argument.

If Multiplier had no default and was not optional, the bare cheat invocation would fail with Argument Multiplier is required but was not specified or defaulted.