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");};
}
Announcement
Collapse
No announcement yet.
How to use UFUNCTION macro with inline methods?
Collapse
X
-
falola repliedis it possible to create a #define macro to create blueprint callable functions?
Leave a comment:
-
Arty-McLabin repliedfor BlueprintNativeEvents use this syntax:
Code:
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "local") FORCEINLINE
USoundCue* getEmptyChamberSound();
USoundCue* getEmptyChamberSound_Implementation(){return nullptr;};
thank me later
Last edited by Arty-McLabin; 02-06-2018, 09:28 AM.
- 1 like
Leave a comment:
-
MaFloBra repliedOriginally posted by kamrann View PostIt'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.
Leave a comment:
-
kamrann repliedIt'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.
- 3 likes
Leave a comment:
-
MaFloBra repliedWell, 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
Leave a comment:
-
ryan20fun repliedWhy do you want it to be inlined?
I would suggest getting the function to show up in BP before (trying) to get it inlined.
HTH
Leave a comment:
-
ryan20fun repliedMy game mode class starts like this:
Code:UCLASS(minimalapi) class AGDemoGameMode : public AGameMode { GENERATED_BODY()
HTH
Leave a comment:
-
MaFloBra started a topic How to use UFUNCTION macro with inline methods?How to use UFUNCTION macro with inline methods?
I have the following method in my game mode class (header file):
Code:void BadBugDied(APawn* BadBug) { BadBugs.Remove(BadBug); }
Now I add the UFUNCTION macro, to call this method from BP:
Code:UFUNCTION(BlueprintCallable, Category = "Bad Bugs") FORCEINLINE void BadBugDied(APawn* BadBug) { BadBugs.Remove(BadBug); }
"Unrecognized type 'void' - type must be a UCLASS, USTRUCT or UENUM"
The same error occurs also when I use the inline keyword instead of the FORCEINLINE macro.
Am I missing something here?Last edited by MaFloBra; 07-17-2016, 08:17 AM.Tags: None
Leave a comment: