The compiler refuses to compile this function for some reason stating: Unrecognized type ‘void’ - type must be a UCLASS, USTRUCT or UENUM
If I change void to something like int32 and add “return 0;” to the end of the function it works, but for some reason it won’t compile as long as the return type is void. What the hell is going on?
EDIT: Forgot to mention that this error only occurs if the function is FORCEINLINE
// this compiles for me , Engine version 4.14 but only recently stepped version up so should no be an issue for 4.12
FORCEINLINE UFUNCTION(BlueprintCallable, Category = “Something|WasHere”)
void Set_Root_Component(USceneComponent* newRoot) { ActorRootComponent = newRoot; }
Wow, that actually compiles… seemingly even for non-void return types. This makes me wonder why the starter template code, as well as several C++ examples from Epic Games doesn’t do this.
It appears that there are some side-effects to placing FORCEINLINE before UFUNCTION for non-void return types. While it works fine in C++, it might not show up in Blueprints anymore. So I guess you should only do it for non-void return types, or not at all if you want the function to be used within blueprints.
void c++ functions are translated to BP as events.
i am not sure how logical is for ue4 event to be inline.
you can use int return type as a placeholder depending on your design.
also try to access the event from event graph rather than overriding it in functions tab is thats what you do