Function Libraries (C++)
UBlueprintCheatArgumentLibrary, UBlueprintCheatsUIFunctionLibrary, and the custom K2 node for typed enum reads.
Two UBlueprintFunctionLibrary classes ship with the plugin. They are
the supported entry points for reading/writing argument values from
either C++ or Blueprint — the templated GetValue<T> / SetValue<T>
on the argument base are usable, but the library performs the
type-and-HasValue check and is what callers usually want.
UBlueprintCheatArgumentLibrary
- Header:
Source/BlueprintCheats/Public/BlueprintCheatArgumentLibrary.h
UCLASS()
class BLUEPRINTCHEATS_API UBlueprintCheatArgumentLibrary : public UBlueprintFunctionLibrary;Every getter validates Argument != nullptr, GetType() == ExpectedType,
and (for value getters) HasValue() == true. On mismatch, the function
returns false and the out-parameter receives a sentinel.
Read current value
static bool GetCheatArgumentAsBool (const UBlueprintCheatArgument* Argument, bool& Out);
static bool GetCheatArgumentAsInt (const UBlueprintCheatArgument* Argument, int32& Out);
static bool GetCheatArgumentAsFloat (const UBlueprintCheatArgument* Argument, float& Out);
static bool GetCheatArgumentAsDouble (const UBlueprintCheatArgument* Argument, double& Out);
static bool GetCheatArgumentAsString (const UBlueprintCheatArgument* Argument, FString& Out);
static bool GetCheatArgumentAsEnumValue(UPARAM(ref) const UBlueprintCheatArgument* Argument,
UEnum* ExpectedEnum, int32& ValueOut);GetCheatArgumentAsString works for any type — it forwards to
GetValueAsString() after the null/value check. Useful for logging
or when you don't care about the type.
GetCheatArgumentAsEnumValue verifies ExpectedEnum matches the
argument's configured enum class before reading.
Read default value
Mirrors of the above, but read InternalDefaultValue instead of
InternalValue:
static bool GetCheatArgumentDefaultBoolValue (const UBlueprintCheatArgument*, bool&);
static bool GetCheatArgumentDefaultIntValue (const UBlueprintCheatArgument*, int32&);
static bool GetCheatArgumentDefaultFloatValue (const UBlueprintCheatArgument*, float&);
static bool GetCheatArgumentDefaultDoubleValue (const UBlueprintCheatArgument*, double&);
static bool GetCheatArgumentDefaultStringValue (const UBlueprintCheatArgument*, FString&);
static bool GetCheatArgumentEnumDefaultValueDisplayName(UPARAM(ref) const UBlueprintCheatArgument*, FText&);Read clamps and metadata
static bool GetCheatArgumentIntMinMax (const UBlueprintCheatArgument*, int32& MinOut, int32& MaxOut);
static bool GetCheatArgumentFloatMinMax (const UBlueprintCheatArgument*, float& MinOut, float& MaxOut);
static bool GetCheatArgumentDoubleMinMax (const UBlueprintCheatArgument*, double& MinOut, double& MaxOut);
static bool GetCheatArgumentStringLengthMinMax(const UBlueprintCheatArgument*, int32& MinOut, int32& MaxOut);
static bool GetCheatArgumentEnumDisplayNames(UPARAM(ref) const UBlueprintCheatArgument*,
TArray<FText>& DisplayNames);These are the functions custom argument widgets call from
OnExpectedArgumentSet to configure their controls.
Write current value
Setters are non-validating: they no-op when GetType() doesn't match
ExpectedType.
static void SetCheatArgumentBooleanValue (UBlueprintCheatArgument*, const bool&);
static void SetCheatArgumentIntValue (UBlueprintCheatArgument*, const int&);
static void SetCheatArgumentFloatValue (UBlueprintCheatArgument*, const float&);
static void SetCheatArgumentDoubleValue (UBlueprintCheatArgument*, const double&);
static void SetCheatArgumentStringValue (UBlueprintCheatArgument*, const FString&);Implementation details
The library is a thin wrapper over three private templated helpers:
template<typename T>
static bool GetCheatArgumentValue_Internal(const UBlueprintCheatArgument*,
EBlueprintCheatArgumentType,
const T& InvalidValue, T& Out);
template<typename T>
static bool GetCheatArgumentDefaultValue_Internal(const UBlueprintCheatArgument*,
EBlueprintCheatArgumentType,
const T& InvalidValue, T& Out);
template<typename T>
static void SetCheatArgument_Internal(UBlueprintCheatArgument*,
EBlueprintCheatArgumentType, const T& In);If you're authoring a custom argument subclass and want a similar
helper for it, you can call these directly from a sibling library (or
roll your own using Argument->GetValue<T>() after the type check).
UBlueprintCheatsUIFunctionLibrary
- Header:
Source/BlueprintCheats/Public/UI/BlueprintCheatsUIFunctionLibrary.h
UCLASS()
class BLUEPRINTCHEATS_API UBlueprintCheatsUIFunctionLibrary : public UBlueprintFunctionLibrary;BuildWidgetForArgument
UFUNCTION(BlueprintCallable, Category="Blueprint Cheats|Arguments|UI",
meta=(WorldContext="WorldContextObject"))
static UBlueprintCheatArgumentWidgetBase* BuildWidgetForArgument(
UBlueprintCheatArgument* ForArgument,
UUserWidget* OwningWidget);Looks up the widget class for ForArgument's class in
UBlueprintCheatsSettings::ArgumentTypeToWidgetMap,
constructs a widget owned by OwningWidget, and calls
SetExpectedArgument to bind the argument. Returns nullptr if no
mapping is registered for the argument's class.
This is what the default menu-item row uses to populate
ControlsContainer.
Custom K2 nodes
The BlueprintCheatsNodes module ships node-based helpers that
specialize the library calls:
UK2Node_GetCheatArgumentAsEnum
- Header:
Source/BlueprintCheatsNodes/Public/K2Node_GetCheatArgumentAsEnum.h - Module:
BlueprintCheatsNodes(UncookedOnly)
UCLASS()
class BLUEPRINTCHEATSNODES_API UK2Node_GetCheatArgumentAsEnum final : public UK2Node;A pure node that reads an enum argument and exposes a strongly-typed
enum output pin derived from the argument's configured enum class —
avoiding the manual int32 → enum conversion required by
GetCheatArgumentAsEnumValue.
Pins:
- Argument input — the
UBlueprintCheatArgument*. - Result output — typed enum value.
- Success bool.
The node lives in the BP action menu under the Blueprint Cheats
category. Implementation detail of interest: it stores the resolved
enum on ExpectedEnumPath : FTopLevelAssetPath and refreshes the
output pin type via RefreshOutputPinType() on
PinDefaultValueChanged / NotifyPinConnectionListChanged.
This node is expanded into a normal pure call at compile time; there is no runtime overhead.