Just wanted to say I found this super helpful. Thank you!
How can I execute multiple exec output pins? (like the Sequence node does for example).
You canāt do that without custom nodes, like the Sequencer
one.
With a function and an Enum, the execution pin is decided by the Enum return value after the function has executed. By then, the function would have to be called again for you to set a different pin (Enum value).
I found myself wanting to do this for a blueprint function that isnāt written in C++. I guess for that the only way is blueprint a macro? Iāve been able to do this with macros before. Itās kindof annoying because I specifically would like to do a function instead, but whatever.
Also Rig VM seems to allow you to do arbitrary exec pins, just not blueprint.
Unfortunately that doesnāt seem to work
Just to summarize:
In your .h file, you need to declare the enumerator. This needs to be done before the UCLASS() like so:
UENUM(BlueprintType)
enum class EMyEnum : uint8
{
BranchA,
BranchB
};
UCLASS()
class MYCLASS_API UBPFL_MyFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
};
DO NOT DECLARE THE ENUM AFTER UCLASS() like so, as it will not work:
UCLASS()
class MYCLASS_API UBPFL_MyFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UENUM(BlueprintType)
enum class EMyEnum : uint8
{
BranchA,
BranchB
};
Next, you need to declare the function after the UCLASS(), like so:
UENUM(BlueprintType)
enum class EMyEnum : uint8
{
BranchA,
BranchB
};
UCLASS()
class MYCLASS_API UBPFL_MyFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Stuff", Meta = (ExpandEnumAsExecs = "Branches"))
void DoSomeBranch(int32 SomeInput, EMyEnum& Branches)
};
Then, in the .cpp file, you add your logic, like so:
void UBPFL_MyFunctionLibrary::DoSomeBranch(int32 SomeInput, EMyEnum& Branches)
{
if (SomeInput == 1)
{
Branches = EMyEnum::BranchA;
}
else
{
Branches = EMyEnum::BranchB;
}
}