How to set value of variable directly in blueprint node, no link to other variable

Greetings!
I create a C++ class and contains several function

UCLASS()
class UBigNumberLibrary : public UBlueprintFunctionLibrary
{
    GENERATED_BODY()

public:
    // 构造方法
    UFUNCTION(BlueprintPure, Category = "BigNumber", meta = (DisplayName = "CreateBigNumber"))
    static FBigNumber MakeBigNumber(const FString& NumberString);

    // 算术运算
    UFUNCTION(BlueprintPure, Category = "BigNumber", meta = (DisplayName = "BigNumberAdd"))
    static FBigNumber Add(const FBigNumber& A, const FBigNumber& B);

    UFUNCTION(BlueprintPure, Category = "BigNumber", meta = (DisplayName = "BigNumberSubtract"))
    static FBigNumber Subtract(const FBigNumber& A, const FBigNumber& B);

    UFUNCTION(BlueprintPure, Category = "BigNumber", meta = (DisplayName = "BigNumberMultiply"))
    static FBigNumber Multiply(const FBigNumber& A, const FBigNumber& B);

    UFUNCTION(BlueprintPure, Category = "BigNumber", meta = (DisplayName = "BigNumberDivide"))
    static FBigNumber Divide(const FBigNumber& A, const FBigNumber& B);
    // 次方运算
    UFUNCTION(BlueprintPure, Category = "BigNumber", meta = (DisplayName = "BigNumberPower"))
    static FBigNumber Power(const FBigNumber& A, const double& PowExponent, const bool& isNeedCheck = false);

    // 字符串转换
    UFUNCTION(BlueprintPure, Category = "BigNumber", meta = (DisplayName = "BigNumberToString"))
    static FString ConvertToString(const FBigNumber& Number);
};

I want to set value of variable in the node itself, and function “CreateBigNumber” seems work it right, I can set a string on CreateBigNumber node. However, in node “BigNumberPower” can not set “PowExponent” and “isNeedCheck” on the node itself, it must link to “get isNeedCheck” node to get value.


So how to set value of variable directly in blueprint node?
Thanks alot!

Hi!

I know two ways to handle this problem:

  1. Made function params as variables, instead of const references
  2. Add AutoCreateRefTerm specifier to the UFUNCTION


BenUI has excelent documentation about various UE speicifiers, I know about AutoCreateRefTerm from there: All UFUNCTION Specifiers · ben🌱ui

3 Likes

Thanks a lot! It works!
More over, why there’re those 3 ways to put in value and can work nearly the same, and what’s the difference of them?