x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Blueprint Callable does not compile, retrun reseult error

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:

 USTRUCT()
 struct STATEMACHINE_API FStateMachineResult 
 {
     GENERATED_USTRUCT_BODY()
 
     UPROPERTY()
     EStateMachineCompletionType CompletionType;
 
     UPROPERTY()
     USM_State* FinalState;
 
     UPROPERTY()
     int32 DataIndex;
 };
Product Version: UE 4.21
Tags:
more ▼

asked Feb 27 '19 at 04:51 PM in C++ Programming

avatar image

drmatt
3 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered Feb 27 '19 at 05:06 PM

avatar image

KristofMorva
1.4k 6 5 7

avatar image drmatt Feb 27 '19 at 06:19 PM

The error is still the same after adding the Blueprintable call

avatar image GarnerP57 Feb 27 '19 at 06:35 PM

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

avatar image KristofMorva Feb 27 '19 at 06:39 PM

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)?

avatar image drmatt Feb 28 '19 at 02:30 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question