Reliable and Run on server in C++ code

Create 1 function for network and 1 function for BlueprintNativeEvent

Like this:

Foo.h

UFUNCTION(BlueprintNativeEvent, Category = "")
void doStuff(int32 stuff);
virtual void doStuff_Implementation(int32 stuff);

UFUNCTION(Server, Reliable, WithValidation)
void doStuffNetwork(int32 stuff);

Foo.cpp

void AFoo::doStuff_Implementation(int32 stuff)
{
	GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::Green, 
		FString::Printf(TEXT("Stuff %i"), stuff));
}

void AFoo::doStuffNetwork_Implementation(int32 stuff)
{
	doStuff(stuff);
}

bool AFoo::doStuffNetwork_Validate(int32 stuff)
{
	return true;
}
1 Like