Any better ways to make RPCs which are visible AND overrideable in either C++ or Blueprints?

I’m fairly new to UE4 and I wanted to see if there were any better ways to do what I’m doing right now.

I want a server RPC function which:

  • Is callable by both C++ and Blueprints
  • Is overrideable in Blueprints as well as C++

The basic C++ declared RPC with BlueprintCallable gets me the C++ / Blueprint visibility, but NOT the BP overrideable aspect, because you’re not allowed to use BlueprintNativeEvent on Server functions. I.e.



UFUNCTION(BlueprintCallable, Server, Reliable)
void DoSomethingOnServer();


I don’t want to just create a BP Server event because that’s not visible to C++.

So right now I double-dispatch like this:

Header file:



...
public:
    UFUNCTION(BlueprintCallable, Server, Reliable)
    void DoSomethingOnServer();
protected:
    UFUNCTION(BlueprintNativeEvent)
    void DoSomethingOnServer_ServerFunc(float Force, FVector CentreOffset);
...


Source:



void MyClass::DoSomethingOnServer_Implementation()
{
    DoSomethingOnServer_ServerFunc();
}
void MyClass::DoSomethingOnServer_ServerFunc()
{
    // Either I can implement stuff here, and/or override in BP
    // (If I only want BP right now I can use BlueprintImplementableEvent and skip this C++ impl)
}


This gets me what I want because I can call DoSomethingOnServer from C++ and BP, and whatever code is in DoSomethingOnServer_ServerFunc, in either C++ or Blueprints, will be executed server side.

Am I insane? Is there a better way to hit these feature points?