Blueprint Callable does not compile, retrun reseult error

I think it needs to be USTRUCT(Blueprintable), and it should work that way.

I’m currently trying to reproduce the C++ State Machine plugin Live Training using 4.21.
Video and code source from here.

I can’t seem to compile my code as I keep getting a LogCompile: Error: Type 'FStateMachineResult' is not supported by blueprint. RunState.ReturnValue and UnrealHeaderTool failed for target 'PluginDevEditor' (platform: Win64, module info: <userpath>\PluginDev\Intermediate\Build\Win64\PluginDevEditor\Development\PluginDevEditor.uhtmanifest, exit code: OtherCompilationError (5)).

My code for the function uses the blueprintcallable for ufunction:

UFUNCTION(BlueprintCallable, Category = "State Machine")
virtual FStateMachineResult RunState(const UObject* RefObject, 
const TArray<USM_InputAtom*>& DataSource, int32 DataIndex = 0, int32 RemainingSteps = -1);

Even after comparing the code to the source code provided in the training, i can’t seem to figure this issue out.

The return value is a struct, here’s the struct in question:

struct STATEMACHINE_API FStateMachineResult 

	EStateMachineCompletionType CompletionType;

	USM_State* FinalState;

	int32 DataIndex;

The error is still the same after adding the Blueprintable call

It should be BlueprintType not Blueprintable as far as I recall.

1 Like

Hmmm, I remembered Blueprintable is needed for being able to use in BPs and BlueprintType to be able to create variables of such type in BPs, but maybe that was only for classes? I’m not sure.

@drmatt can you try BlueprintType too, and show us the most recent struct definition you have (in case it’s still not working)?

I made a human error and ended up modifying the wrong copy of the file. Blueprintable was the correct call for the struct.

everything now works

Thanks Kristof! Similar issue in UE 4.25. However, it seems only to require the Blueprintable when I set default values in the struct.
If you are not setting defaults in the Struct, then USTRUCT() seems to suffice.