RealDocs

UActorComponent::CallRemoteFunction

function Engine Since 4.0
#include "Components/ActorComponent.h"
Access: public Specifiers: virtualoverride

Description

Sends an RPC call for this component to the appropriate remote endpoint via the owning actor's net driver. Returns true if the call was dispatched remotely.

Caveats & Gotchas

  • This is invoked by the engine's RPC machinery — you should almost never call it directly. Calling it incorrectly can bypass authority checks and corrupt network state.
  • The function delegates to the owning actor's NetDriver via the actor's connection. If the component has no valid owner or the owner has no net connection, the call silently fails and returns false.

Signature

ENGINE_API virtual bool CallRemoteFunction( UFunction* Function, void* Parameters, FOutParmRec* OutParms, FFrame* Stack ) override;

Parameters

Name Type Description Default
Function UFunction* The UFunction representing the RPC to invoke.
Parameters void* Pointer to the packed parameter data for the function.
OutParms FOutParmRec* Output parameter records for functions with out parameters.
Stack FFrame* The current script execution frame.

Return Type

bool

Example

How the engine internally routes a Server RPC C++
// This is called by the engine — shown here for understanding only.
// When a UFUNCTION(Server, Reliable) is called on a component,
// the blueprint VM calls GetFunctionCallspace, then CallRemoteFunction:
bool UActorComponent::CallRemoteFunction(UFunction* Function, void* Parameters, FOutParmRec* OutParms, FFrame* Stack)
{
    AActor* Owner = GetOwner();
    if (UNetDriver* NetDriver = Owner ? Owner->GetNetDriver() : nullptr)
    {
        NetDriver->ProcessRemoteFunction(Owner, Function, Parameters, OutParms, Stack, this);
        return true;
    }
    return false;
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.