It’s annoying to have to write 4 functions for server packets, especially when a variable changes. It also clutters up my header file. I was trying to make a preprocessor macro.
// Send a Chat to the Server
UFUNCTION(Reliable, Server, WithValidation)
void ServerSendChat(EPlayerChatChannel ChatChannel, const FString& Message, const FString& Override);
void ServerSendChat_Implementation(EPlayerChatChannel ChatChannel, const FString& Message, const FString& Override);
bool ServerSendChat_Validate(EPlayerChatChannel ChatChannel, const FString& Message, const FString& Override);
void SendChat(EPlayerChatChannel ChatChannel, const FString& Message, const FString& Override);
#define UNREAL_SERVER_FUNCTION(FunctionName, ...) \
void FunctionName##( __VA_ARGS__); \
UFUNCTION(Reliable, Server, WithValidation) \
void Server##FunctionName##(__VA_ARGS__); \
void Server##FunctionName##_Implementation(__VA_ARGS__); \
bool Server##FunctionName##_Validate(__VA_ARGS__);
UNREAL_SERVER_FUNCTION(SendChat, EPlayerChatChannel ChatChannel, const FString& Message, const FString& Override)
The problem is Unresolved External Symbols on the Server##FunctionName##(), meaning Unreal isn’t generating that function. I am guessing this macro doesn’t inline everything needed for Unreal’s reflection system. Any suggestions?