Use Chooser Plugin in C++

Hey,

No problem, that’s ok.

That’s correct and make sense, if you take a look in your print, your ChooserTable set a enum that is inside your struct.

Your Enum ActionType comes from your struct FTraversalChooserOutputs, to better ilustrate, look this example:

.h file

UENUM(BlueprintType)
enum class ESVMovementState : uint8
{
	Idle,
	Walk,
	Run,
	Sprint
};

USTRUCT(BlueprintType)
struct FTraversalChooser
{
	GENERATED_BODY()
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	ESVMovementState MovementState;
};

In Chooser Table editor:

Look, I’m not sure what you are trying to do, all I know is you’d like to get the return data in C++, so there is a quick solution to achieve this, create a BlueprintImplementableEvent, that’s going to save you much time, since you can call this function in C++ and implement it in Blueprint, simple example:

.h file

UENUM(BlueprintType)
enum class ESVMovementState : uint8
{
	Idle,
	Walk,
	Run,
	Sprint
};

USTRUCT(BlueprintType)
struct FTraversalChooserIn
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	bool bIsMoving;
};

USTRUCT(BlueprintType)
struct FTraversalChooserOut
{
	GENERATED_BODY()
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	ESVMovementState MovementState;
};


UCLASS()
class DEV55_API ADevCharacter : public ACharacter
{
	GENERATED_BODY()

	UPROPERTY()
	FTraversalChooserOut OutData;
	
	UPROPERTY()
	FTraversalChooserIn InData;

public:
	
UFUNCTION(BlueprintImplementableEvent, Category = "Player|Anim")
	TArray<UAnimMontage*> CustomEvaluatedAnimMontage(FTraversalChooserIn InTraversal, FTraversalChooserOut& OutTraversal);
};

In Chooser Table:

In Your Blueprint override your custom function:

.cpp file - call your function:

InData.bIsMoving = true;

TArray<UAnimMontage> MontagesToPlay = CustomEvaluatedAnimMontage(InData, OutData);

May this solve your issue

Bye.

1 Like