Recommendation
Replicate durable state, use RepNotify when receiving machines must react to that state changing, and use RPCs for transient requests or events.
Compare the options
Replicated Property
Choose when
- Clients need the latest authoritative value.
- The value must survive relevancy changes or late joining.
Tradeoffs
- Updates follow net update and relevancy rules.
- Property replication is not an immediate function return.
- Blueprint
- Set the variable Replication property to Replicated.
- C++
- Use UPROPERTY(Replicated) and register it in GetLifetimeReplicatedProps.
RepNotify
Choose when
- The durable value must replicate.
- Receiving machines need to update presentation or dependent state.
Tradeoffs
- Unrelated property notifications are not a transaction.
- Server-side handling may need an explicit local call depending on the implementation.
- Blueprint
- Set the variable Replication property to RepNotify and implement its generated OnRep event.
- C++
- Use UPROPERTY(ReplicatedUsing=OnRep_Name) and implement OnRep_Name.
RPC
Choose when
- A client requests a server action.
- The server targets an owning client.
- A transient cosmetic event is sent to relevant peers.
Tradeoffs
- Ownership controls whether and where the RPC executes.
- Reliable RPCs consume more bandwidth and block later RPC delivery until acknowledged.
- Blueprint
- Use a replicated Custom Event set to Run on Server, Run on Owning Client, or Multicast.
- C++
- Use UFUNCTION(Server), UFUNCTION(Client), UFUNCTION(Remote), or UFUNCTION(NetMulticast), with Reliable only when delivery is required.
Requirements
The Actor and relevant Actor Component must replicate. Ownership controls unicast RPC execution. NetMulticast RPCs must be called by the server to reach clients.
Example
Replicate Current Health with RepNotify so late clients get the value and UI reacts. Use a Server RPC for a client fire request. Use an unreliable Multicast for a nonessential impact effect.