Well, whether or not a function or method in C++ should or should not be inlined is a broad topic, which I don’t want to discuss here. My question was more if it is possible in UE4 to have an inlined UFUNCTION
It’s probably just a limitation of UHT (it has many).
It’s completely unnecessary though, inline or not is totally insignificant in comparison to the overhead of calling a function from blueprint. If you need to call this function from C++ a lot, then make an inline function to do the work, and then a separate BlueprintCallable UFUNCTION that just calls the inline function.
If you’re going to be calling the function so often from blueprint that you’re worrying about inlining it though, then you just shouldn’t be calling it from blueprint in the first place.
It may be a bug, but the solution is simple. Just remove the ‘inline’, and write the definition to the header. All definitions in a header will be treated as inline function.
class UAxx
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
void Hello(){printf(“xxx”);};
}
I’ve also been putting it at the end of the header file. But I always questioned whether or not it’s truly inlined if it’s a UFUNCTION. The compiler can still decide something isn’t inline if it can’t be. And maybe UFUNCTION can’t be inline.
class UAxx
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
void Hello();
}