Search code examples
c++visual-c++unreal-engine4unreal-blueprint

[Unreal Engine 4]Making Node with 2 exec working together


So here is my issue. I'm trying to create function, which goes on straight away, but also have second exec output, which goes after let's say completing loop.

I tried to make this work with this: thread i googled.

However my issue is when i tried doing it with accepted answer provided i got this error:

E0434   a reference of type "TEnumAsByte<EMyEnum> &" (not const-qualified) cannot be initialized with a value of type "EMyEnum"

Going furthere below there is second answer, which work but it always goes off form last possible pin.In case I show below it always fire "FinishOutput". Is there any way i can force code to output from both pins i provide? Here is how it looks in my code:

.h file

UENUM(BlueprintType)
enum  class EMyEnum : uint8
{
    Output,
    FinishOutput
};

UFUNCTION(BLueprintCallable, Category = "Test", Meta = (ExpandEnumAsExecs = "Branches"))
        static void OutputTest(TEnumAsByte<EMyEnum>& Branches);

.cpp file

void UAudioController::OutputTest(TEnumAsByte<EMyEnum>& Branches)
{
        Branches = EMyEnum::Output;
//some code to execute before second output
        Branches = EMyEnum::FinishOutput;

}

Solution

  • I would make a Macro since it can have multiple Exec outputs. This is in blueprint, not code.