RealDocs

AActor::ExchangeNetRoles

function Engine Since 4.0
#include "GameFramework/Actor.h"
Access: public

Description

Swaps the Role and RemoteRole of this actor when called on a client to establish correct local authority perspective. Called internally by the engine after deserializing a replicated actor.

Caveats & Gotchas

  • Engine-internal — calling this from gameplay code will corrupt the actor's role state and produce undefined networking behaviour.
  • After the swap, HasAuthority() will return false on the client as expected; the remote server holds ROLE_Authority.
  • Only swaps when bRemoteOwner is true; passing false is a no-op and exists to allow the engine to call this unconditionally.

Signature

ENGINE_API void ExchangeNetRoles(bool bRemoteOwner)

Parameters

Name Type Description Default
bRemoteOwner bool Pass true when this actor is owned by a remote connection (client); causes Role and RemoteRole to be swapped.

Return Type

void

Example

Internal engine usage (informational only) C++
// Called by the engine after receiving an actor over the network — not for direct use.
// Actor->ExchangeNetRoles(/*bRemoteOwner=*/true);

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.