When is it appropriate to use UFUNCTION() macro? Right now it’s above all my functions but has it got any downsides when i just leave it with empty brackets? Does it have any effect on performance? What about overriden functions, should/can i use UFUNCTION on them too?
2 Likes
#Uses of UFUNCTION()
- anything involving keybinding / action mapping
- OnRep functions in multiplayer
- Server/Client functions
- functions to be executed via console command
Rama
Didn’t you forget the most amazing thing ever?
BlueprintCallable! etc.
Here is a list of the Specifiers
Has UFUNCTION’ing every function has any downsides?
1 Like
You’ll have more generated code that you might not need. It will increase compile times some along with executable size.
1 Like
complementing Rama’s answer: whenever you use “void BindUFunction( UObject* InObject, const FName& InFunctionName )” for binding delegates.
For instance when you want to use FTimeline:
FOnTimelineFloat InterpFloatFunction = FOnTimelineFloat();
InterpFloatFunction.BindUFunction(this, "ThisFunctionShouldBeMarkedAsUFunction");
FTimeline MyTimeline = FTimeline();
MyTimeline.AddInterpFloat(SomeCurve, InterpFloatFunction, "InterpFloatFunctionName");