RealDocs

AActor::SetAutonomousProxy

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

Description

Changes the actor's local network role to AutonomousProxy (client-driven) or SimulatedProxy (server-driven). Called by the engine when assigning possession of a pawn to a player controller.

Caveats & Gotchas

  • This is a low-level engine call — in almost all cases you should go through APlayerController::Possess() or AController::OnPossess() rather than calling SetAutonomousProxy directly, which can leave controller/pawn state inconsistent.
  • Setting bAllowForcePropertyCompare=false skips the property comparison pass which can cause replication of stale property values on the next update cycle; only disable it when you know the property set is already clean.
  • Only meaningful on the server or in single-player; calling it on a client has no network effect since RemoteRole is assigned by the server.

Signature

ENGINE_API void SetAutonomousProxy(const bool bInAutonomousProxy, const bool bAllowForcePropertyCompare=true);

Parameters

Name Type Description Default
bInAutonomousProxy bool True to set the local role to ROLE_AutonomousProxy, false to set it to ROLE_SimulatedProxy.
bAllowForcePropertyCompare bool When true, forces a dirty-flag comparison on replicated properties after the role change. true

Return Type

void

Example

Force a pawn to autonomous proxy role after custom possession logic C++
// Only call this if bypassing the standard Possess path
void AMyGameMode::CustomPossess(APawn* Pawn, APlayerController* PC)
{
    Pawn->SetOwner(PC);
    Pawn->SetAutonomousProxy(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.